I'm trying to set up a Raspberry Pi Pico for the first time. I've got MicroPython installed, and got my environment set up in PyCharm. I wrote a simple program to test my setup, and I'm getting this error:
Traceback (most recent call last):
File "D:\...\Blink.py", line 1, in <module>
from machine import Pin
ModuleNotFoundError: No module named 'machine'
Here's the code:
from machine import Pin
import time
led = Pin(25, Pin.OUT)
while True:
led(1)
time.sleep(1)
led(0)
time.sleep(1)
I've found other questions where people had a similar problem when using an ESP32, but how can I handle this in PyCharm with a Pi Pico?
Be sure you are running the code in the Raspberry Pi Pico, not in your computer.
Use the Thonny IDE, because you can easily run and save the code in the Raspberry Pi Pico link to download the Thonny IDE and then use this link to know how to set up this IDE to run the code on the Raspberry Pi Pico.