Page 1 of 1

"Import machine" not working on RPi Pico

Posted: Sun Jan 31, 2021 4:42 pm
by Odolyte
Hi,

with last micropython image : adafruit-circuitpython-raspberry_pi_pico-fr-6.2.0-beta.1.uf2
using Thonny, when i do a

Code: Select all

print("Hello Pico")
everything works fine, but when i try to make the onboard led blink with :

Code: Select all

import machine
import utime
led_onboard = machine.Pin(25, machine.Pin.OUT)
while True:
	led_onboard.value(1)
	utime.sleep(1)
	led_onboard.value(0)
	utime.sleep(1)
i got a "machine module missing" error (the screencapture :https://www.evernote.com/l/ABio1aoE_b9L ... 4gPvzXmso8).

What did i do wrong?

Thanks for your Help,

Odo

Re: "Import machine" not working on RPi Pico

Posted: Sun Jan 31, 2021 4:51 pm
by Roberthh
In the Micropython.org firmware zhe mschine module exist. Try the proper firmware from the micropython.org download page.

Re: "Import machine" not working on RPi Pico

Posted: Mon Feb 01, 2021 12:02 am
by jimmo
Odolyte wrote:
Sun Jan 31, 2021 4:42 pm
with last micropython image : adafruit-circuitpython-raspberry_pi_pico-fr-6.2.0-beta.1.uf2
That looks like CircuitPython firmware, not MicroPython. The machine module is a MicroPython thing.

CircuitPython has different ways of accessing hardware features. You can get the MicroPython firmware from http://micropython.org/download/rp2-pico/

Re: "Import machine" not working on RPi Pico

Posted: Mon May 17, 2021 11:16 am
by Cyprus125
I'm in the same boat, machine is in the imported library, but when i run debug, it's like not able to import machine does not exist.

going to loose my mind!!!

Re: "Import machine" not working on RPi Pico

Posted: Tue May 18, 2021 12:28 pm
by pythoncoder

Re: "Import machine" not working on RPi Pico

Posted: Mon May 24, 2021 10:50 pm
by skinsman
Cyprus125 wrote:
Mon May 17, 2021 11:16 am
I'm in the same boat, machine is in the imported library, but when i run debug, it's like not able to import machine does not exist.
You haven't provided much info but you said "when i run debug" - how are you doing this? I would love to be wrong but I understand there's no way to run a debug session on a MicroPython board so does that mean you're running debug with a Python interpreter on your PC? Then no, it won't have libraries like "machine". I don't know the best way around this, and actually I've just joined this forum so I can ask a question about it which I'll do soon under "Programs, Libraries and Tools".