Showing posts with label esp8266. Show all posts
Showing posts with label esp8266. Show all posts

Thursday, September 15, 2016

Reading DHT22 and Light sensor data using NodeMCU dev board

Moved to http://asknotes.com/2016/09/15/reading-dht22-and-light-sensor-data-using-nodemcu-dev-board/

tmr.alarm not working on ESP12E 0.9.5 firmware

Tested that this sample was not working on dev board:

if not tmr.alarm(0, 5000, tmr.ALARM_SINGLE, function() print("hey there") end) then print("whoopsie") end

Checked firmware version (connected to ESPlorer and pressed reset):
ESP12E default NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4

Decided to update firmware. Found here that only 9.6 is available precompiled, later ones have to be costum built. Downloaded 9.6 files and uploaded them using ESP8266Flasher.exe

Checked firmware version then:
NodeMCU 0.9.6 build 20150704  powered by Lua 5.1.4

And tested this code sample:

if not tmr.alarm(0, 5000, tmr.ALARM_SINGLE, function() print("hey there") end) then print("whoopsie") end

It worked.


How to use Arduino IDE to program NodeMCU

1. Install the Arduino IDE from download section of arduino.cc website 
2. Run Arduino IDE's arduino.exe
3. Arduino IDE >> File >> Preferences (Shourtcut is CTRL + COMMA)>> Settings tab >> on Additional Board Manager URL side type this >> and click ok.

This json object will bring necessary drivers for NodeMCU from the website esp8266.com to our Arduino IDE.
4. Arduino IDE >> Tools >> Board >> Boards Manager... >> Type = Contributed >> click on install (Or, search ESP8266 from the search bar)
5. Arduino IDE >> Tools >> Board >> NodeMCU 1.0 (ESP-12E MODULE)