I have tried to get user input in pico thonny but i can't get user input
from machine import Pin
a = input()
print(a)
I have tried to get user input in pico thonny but i can't get user input
from machine import Pin
a = input()
print(a)
To use Thonny with the Pico, you first need to configure Thonny to interact with the Pico via the serial port:
After completing the above steps, in the "Shell" panel at the bottom of your window you should see something like:
MicroPython v1.18 on 2022-01-17; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>>
At this point, if you enter your code in the code panel and click the "Play" button (or select "Run -> Run current script"), you should first be prompted where to save the script. You can save it either locally on your computer or on the Pico.
Once the script has been saved, in the "Shell" window you should now see:
>>> %Run -c $EDITOR_CONTENT
At this point, the script is running and is waiting for user input. Place the cursor at the bottom of the panel, and then type something and press <RETURN>
. You should see your text echoed back to you:
>>> %Run -c $EDITOR_CONTENT
this is a test
this is a test
>>>