NodeMCU

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
lloureiro
Posts: 2
Joined: Sun Jun 14, 2020 10:03 pm

NodeMCU

Post by lloureiro » Sun Jun 14, 2020 10:10 pm

Im using node mcu, esp 8266 based.

if my main.py only have line with calling help() function, it execute after reset.

but with

Code: Select all

import machine
import time
pin = machine.Pin(2,machine.Pin.OUT)
pin.on()
def toggle(p):
   p.value(not p.value())

while True:
	toggle(pin)
    time.sleep_ms(500)
Or

Code: Select all

import machine
import time
pin = machine.Pin(2,machine.Pin.OUT)
pin.on()
def toggle(p):
   p.value(not p.value())

def main():
    while True:
        toggle(pin)
        time.sleep_ms(500)

if __name__ == '__main__':
    main()
it dont execut after reset. What im doing wrong?
Thanks in advance

User avatar
Roberthh
Posts: 2438
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: NodeMCU

Post by Roberthh » Mon Jun 15, 2020 6:17 am

A few questions:

- how do you connect to the board?
- how did you copy your main.py to the board?
- once you are connected to REPL and push Ctrl-D for reboot or the reset button, what is the result.

lloureiro
Posts: 2
Joined: Sun Jun 14, 2020 10:03 pm

Re: NodeMCU

Post by lloureiro » Mon Jun 15, 2020 6:30 am

Hello,

- how do you connect to the board? ---> with ESPlorer using usb
- how did you copy your main.py to the board? -->using ESPlorer option to copy file
- once you are connected to REPL and push Ctrl-D for reboot or the reset button, what is the result. --> nothing happens, only boot.py is executed. As I said, if my main.py have one line calling help() function, help contents are displayed doing same steps above

User avatar
Roberthh
Posts: 2438
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: NodeMCU

Post by Roberthh » Mon Jun 15, 2020 8:07 am

Are you sure that main.py had been copied to the board. Please run in REPL the commands

import uos
uos.listdir()

That returns a list of files on the device. And maybe you should try a simple tool like putty or picocom or screen for the connection to the board. Not comfortable, but also not bug-hiding.

Post Reply