When using an ESP8266 and sending files to the board via the WebRepl I can use the machine module when typing directly into the console. However, when I send a Python script that imports the machine module to the board and import it to the console and run the method the code that uses the module doesn't run. I can access other modules and run other code that I have sent onto the board. Also when writing the Python script importing the machine module appears as an error.
Can anyone tell me what I am doing wrong when importing the machine
module from MicroPython?
from machine import Pin
from time import sleep
led = Pin(2, Pin.OUT)
for n in range(1,30):
led.on()
sleep(1)
led.off()