NodeMCU is an Open Source Firmware Development Board that helps you to build your IOT(Internet of Things) projects with a few LUA Script Lines, NodeMCU it is like Arduino Hardware with a Input Output built in the Board itself, it has also a Wifi built in to connect directly to internet to control your things online using Nodejs Style network API for digital network applications, which facilitates developers to code running on the Board, Greatly speed up your Internet of Things application development process.
The Development Board base on ESP8266 Chip, integrated GPIO(General Purpose Input Output), PWM(Pulse with Modulation),IIC(Interconnected Integrated Circuit), 1-Wire and ADC all in one board to power up your development board in fastest way combined with the NodeMCU Firmware.
Development Board Features:
- OPEN SOURCE Development Board
- USB to TTL built in “Plug & Play”
- 10x GPIO(General Purpose Input Output)
- Built In Wireless Network(Wifi) to Communicate true out the Internet
Connecting to the wifi network
1 2 3 4 5 6 |
print(wifi.sta.getip()) --nil wifi.setmode(wifi.STATION) wifi.sta.config("SSID","password") -- COnfigure the wireless network (wifi) print(wifi.sta.getip()) -- Get IP Adress --192.168.18.110 |
To Access (GPIO) / Input Out
1 2 3 4 5 |
pin = 1 gpio.mode(pin,gpio.OUTPUT) -- Pin 1 Configure to Output gpio.write(pin,gpio.HIGH) -- Pin 1 swithch swith it On gpio.mode(pin,gpio.INPUT) -- Pin 1 defines as Input print(gpio.read(pin)) -- Pin 1 read the input Pin 1 |
Configure a http client
1 2 3 4 5 6 |
-- Configure as simple http client conn=net.createConnection(net.TCP, false) conn:on("receive", function(conn, pl) print(pl) end) -- Recieve conn:connect(80,"xxx.xx.xx.xxx") -- Public IP Adress of your router forwared to port 80 conn:send("GET / HTTP/1.1\r\nHost: www.14core.com\r\n" .."Connection: keep-alive\r\nAccept: */*\r\n\r\n") |
Configure a http server
1 2 3 4 5 6 7 8 |
-- Configure a http server srv=net.createServer(net.TCP) srv:listen(80,function(conn) -- Define Listening at Port 80 on your router conn:on("receive",function(conn,payload) print(payload) conn:send("<h1> Hello, 14core.com | Ideas Comes to Reality</h1>") end) end) |
Sample Code for PWM(Pulse with Modulation)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
-- Working on Pulse with Modulation function led(r,g,b) -- RGB LED pwm.setduty(1,r) -- Set working on 1 LED Red pwm.setduty(2,g) -- Set to work on 2 LED Green pwm.setduty(3,b) -- Set to work on 3 LED Blue end pwm.setup(1,500,512) pwm.setup(2,500,512) pwm.setup(3,500,512) pwm.start(1) pwm.start(2) pwm.start(3) led(512,0,0) -- LED Red led(0,0,512) -- LED Blue |
Sample code for LED
1 2 3 4 5 6 7 8 9 10 11 12 13 |
-- Sample code for driving LED lighton=0 tmr.alarm(0,1000,1,function() -- Timer will be 1 second if lighton==0 then lighton=1 led(512,512,512) -- 512/1024, 50% duty cycle else lighton=0 led(0,0,0) end end) |
Sample code for Bootstrap
1 2 3 4 5 6 |
--initialize LUA will be executed file.open("init.lua","w") file.writeline([[print("Hello 14core.com")]]) file.close() node.restart() -- this will restart the module. |
Working on Timer to Repeat
1 2 3 4 5 6 |
-- Working on Timer to Repeat tmr.alarm(1,5000,1,function() print("alarm 1") end) -- Timer alarm 5 Second tmr.alarm(0,1000,1,function() print("alarm 0") end) -- Timer alarm 1 Second tmr.alarm(2,2000,1,function() print("alarm 2") end) -- Timer alarm 2 Second -- Delay tmr.stop(0) |
Simple demonstration using LUA Script working on TELNET SERVER
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
-- Demonstration using LUA Script working on TELNET Server -- Simple demonstration how to use telnet server s=net.createServer(net.TCP,180) s:listen(2323,function(c) function s_output(str) if(c~=nil) then c:send(str) end end node.output(s_output, 0) -- re-direct output to function s_ouput. c:on("receive",function(c,l) node.input(l) --like pcall(loadstring(l)), will support multiple separate lines end) c:on("disconnection",function(c) node.output(nil) --unregistered redirect the output function, the output will goes to the serial communication end) print("Welcome to 14Core.com World.") end) |
Demonstration how to Interfe with sensor in NodeMCU
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
-- reading temperature with DS18B20 sensor t=require("ds18b20") t.setup(9) addrs=t.addrs() -- Total numbers Output of DS18B20 Sensor just assume it is 2 print(table.getn(addrs)) -- The first DS18B20 print(t.read(addrs[1],t.C)) print(t.read(addrs[1],t.F)) print(t.read(addrs[1],t.K)) -- The second DS18B20 print(t.read(addrs[2],t.C)) print(t.read(addrs[2],t.F)) print(t.read(addrs[2],t.K)) -- Just read print(t.read()) -- Just read as centigrade print(t.read(nil,t.C)) -- you need to release after use t = nil ds18b20 = nil package.loaded["ds18b20"]=nil |
New Firmware > https://github.com/nodemcu/nodemcu-firmware/releases/tag/0.9.6-dev_20150704
Please kindly provide user manual and installation guide for ESPlorer IDE.
Thanks in Advance.
Please visit the this http://www.14core.com/drivers/ , you can just follow the instructions from installing the software, flashing the NodeMCU and how to compiler your LUA Script.
Аfter exploring a handful of the blog poѕts on your web page,
I seriously like your way of blogging. I book-marked it to my bookmark webpage list
and ѡill be checkіng back in the near futurе.
Take a look at my website аs well and let me know your
opinion.