We will be connecting the NodeMCU to PC, Installing Esplorer IDE, Uploading Latest firmware and a test sketch to blink onboard LED and externally connected LED.
*Firmware flasher to update firmware- https://github.com/nodemcu/nodemcu-flasher/blob/master/Win64/Release/ESP8266Flasher.exe
*Firmware- https://github.com/nodemcu/nodemcu-firmware/releases
I have used - nodemcu_float_0.9.6-dev_20150704.bin firmware
*Pin configuration of nodemcu V 1.0: https://github.com/nodemcu/nodemcu-devkit-v1.0
NOTE- Just plug USB cable between your PC and Nodemcu - no additional hardware modifications or power supply are required.
Unlike other ESP8266 modules,while flashing firmware, loading sketches, running in normal operations, NO NEED of changing any pin configuration (e.g. pulling high or low pin 0 ,2 etc), NodeMCU E12 dev kit does everything internally.
The final code to test onboard LED at gpio0 and externally connected LED ,red, at gpio1-pin D1.
just copy and paste following code in esplorer scripts window and press Send to ESP
--/////////////////////////////////////////Start of Code//////////////////////////////////////////////////////////////
function blinktest()
for i = 1, 10, 1 do -- blink LED 50 times
gpio.write(0, gpio.HIGH) -- note onboard Blue LED is OFF when GPIO0 is high.
gpio.write(1, gpio.HIGH) -- RED LED is ON when GPIO1 is high.
print("Red ON ",i)
tmr.delay(500000) -- wait for 0.5 sec = 500 000 micro-sec
gpio.write(0, gpio.LOW) -- note onboard Blue LED is ON when GPIO0 is Low.
gpio.write(1, gpio.LOW) -- -- RED LED is OFF when GPIO1 is low.
print("Red OFF ",i)
i = i + 1;
tmr.delay(500000) -- wait for 0.5 sec = 500 000 micro-sec
end
end
function testnodemcu()
blinktest()
tmr.delay(10000) -- wait for 10micorsec
print("Congratulations for your first successfull NODEMCU E12 LED blink Test")
gpio.write(0, gpio.HIGH) -- swtich OFF Blue LED at the end
end
testnodemcu() -- function to run the test script
--///////////////////END of CODE///////////////////////////////
Nodemcu V1.0 fritzing part imported from - https://github.com/squix78/esp8266-fritzing-parts/blob/master/nodemcu-v1.0/NodeMCUV1.0.fzpz
No comments:
Post a Comment
Contact me for more information...