Pin as string doesn't work

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
jumperwire
Posts: 7
Joined: Tue Jul 12, 2022 6:01 pm

Pin as string doesn't work

Post by jumperwire » Tue Jul 12, 2022 6:05 pm

Hello,

I have Raspberry Pi Pico W with:

Code: Select all

Python version
3.4.0; MicroPython v1.19.1 on 2022-06-18
Version info.
(3, 4, 0)
When I am trying to run the following:

Code: Select all

from machine import Pin

led = Pin( "LED", Pin.OUT )
led.on()
led.off()
I get an error:

Code: Select all

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
TypeError: can't convert str to int
I can't specify integer value for the LED, because on Pico W it's not pin 25 any more. I have no idea what integer number is the LED on. But everywhere in the google I see people are using string values as well as in documentation it says as id I can use string.
Any idea?

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Pin as string doesn't work

Post by scruss » Tue Jul 12, 2022 10:04 pm

You need to be using the latest unstable version for that to work

iceelon
Posts: 30
Joined: Tue Jul 12, 2022 11:42 am

Re: Pin as string doesn't work

Post by iceelon » Tue Jul 12, 2022 10:53 pm

Hi !!!

you need the firmware for that device by default thonny does not recognize the W model, install manual it is in

jumperwire
Posts: 7
Joined: Tue Jul 12, 2022 6:01 pm

Re: Pin as string doesn't work

Post by jumperwire » Fri Jul 15, 2022 4:05 pm

Thanks, it works now!

Post Reply