現貨供應最新開發模組

NodeMCU v2 - 基於 Lua 之 ESP8266 WiFi 開發板

  • 採用內建 WiFi 通訊功能之 ESP8266
  • 新板 ESP-12E 具備大容量 4MB Flash
  • 基於 eLua 之開源專案、可自行編譯
  • 交談式開發與除錯使用者自訂之應用程式
  • 可燒錄使用者自自訂之應用 scripts
  • 低成本、簡單、智慧、好玩
  • 豐富的中、英文資料,輕易進入物聯網開發
  • 第二代電路板設計特別適合進行麵包板實驗

代號
nodemcu-v2

SKU 即原廠標號
113990105

定價
300
特價
260 (含營業稅)

庫存充裕

開源韌體下載位址

此為適合插入麵包板使用、採用 ESP-12E 4MB Flash 模組之最新改良版,使用時請搭配使用 1.0 版本以上之開發工具

示例

拿到開發板了?我們開始吧

連接到路由器

print(wifi.sta.getip())
--nil
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
print(wifi.sta.getip())
--192.168.18.110

像Arduino一樣操作IO

pin = 1
gpio.mode(pin,gpio.OUTPUT)
gpio.write(pin,gpio.HIGH)
gpio.mode(pin,gpio.INPUT)
print(gpio.read(pin))

簡單的HTTP客戶端

-- A simple http client
conn=net.createConnection(net.TCP, false) 
conn:on("receive", function(conn, pl) print(pl) end)
conn:connect(80,"121.41.33.127")
conn:send("GET / HTTP/1.1\r\nHost: www.nodemcu.com\r\n"
    .."Connection: keep-alive\r\nAccept: */*\r\n\r\n")

更簡單的HTTP服務器

-- a simple http server
srv=net.createServer(net.TCP) 
srv:listen(80,function(conn) 
    conn:on("receive",function(conn,payload) 
    print(payload) 
    conn:send("<h1> Hello, NodeMCU.</h1>")
    end) 
end)

PWM操作

function led(r,g,b) 
    pwm.setduty(1,r) 
    pwm.setduty(2,g) 
    pwm.setduty(3,b) 
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) -- red
led(0,0,512) -- blue

閃爍LED

lighton=0
tmr.alarm(0,1000,1,function()
if lighton==0 then 
    lighton=1 
    led(512,512,512) 
    -- 512/1024, 50% duty cycle
else 
    lighton=0 
    led(0,0,0) 
end 
end)

啟動文件

--init.lua will be excuted
file.open("init.lua","w")
file.writeline([[print("Hello World!")]])
file.close()
node.restart()  -- this will restart the module.

用定時器來循環執行

tmr.alarm(1,5000,1,function() print("alarm 1") end)
tmr.alarm(0,1000,1,function() print("alarm 0") end)
tmr.alarm(2,2000,1,function() print("alarm 2") end)
-- after sometime
tmr.stop(0)

純 Lua 寫的 telnet 服務器

-- a simple 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)), support multiple separate lines
    end) 
    c:on("disconnection",function(c) 
      node.output(nil)        
      --unregist redirect output function, output goes to serial
    end) 
    print("Welcome to NodeMCU world.")
end)

與傳感器接口

-- read temperature with DS18B20
t=require("ds18b20")
t.setup(9)
addrs=t.addrs()
-- Total DS18B20 numbers, 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))
-- Don't forget to release it after use
t = nil
ds18b20 = nil
package.loaded["ds18b20"]=nil

原廠連結:http://www.nodemcu.com/index_cn.html

NodeMCU超簡單的物聯網開發平台

一款開源快速硬件原型平台,包括固件和開發板,用幾行簡單的Lua腳本就能開發物聯網應用

特點

開源,交互式,可編程,低成本,簡單,智能,WI-FI硬件

像Arduino一樣操作硬件IO

提供硬件的高級接口,可以將應用開發者從繁複的硬件配置、寄存器操作中解放出來。用交互式Lua腳本,像arduino一樣編寫硬件代碼!

用Nodejs類似語法寫網絡應用

事件驅動型API極大的方便了用戶進行網絡應用開發,使用類似Nodejs的方式編寫網絡代碼,並運行於5mm*5mm大小的MCU之上,加快您的物聯網開發進度。

超低成本的WI-FI模塊

用於快速原型的開發板,集成了售價低於10人民幣WIFI芯片ESP8266。我們為您提供性價比最高的物聯網應用開發平台。

開發板

基於樂鑫esp8266的NodeMCU開發板,具有GPIO、PWM、I2C、1-Wire、ADC等功能,結合NodeMCU 固件為您的原型開發提供最快速的途徑。

包含usb串口,即插即用

10 GPIO, 每個都能配置為 PWM, I2C, 1-wire

FCC 認證的WI-FI模塊,內置PCB天線

資料來源:https://www.seeedstudio.com/NodeMCU-v2---Lua-based-ESP8266-development-kit-p-2415.html

Description

The NodeMcu is an open-source firmware and development kit that helps you to prototype your IOT product within a few Lua script lines.


FEATURES

  • • Open-source

  • • Interactive

  • • Programmable

  • • Low cost

  • • Simple

  • • Smart

  • • WI-FI enabled

Arduino-like hardware IO

  • • Advanced API for hardware IO, which can dramatically reduce the redundant work for configuring and manipulating hardware.

  • • Code like arduino, but interactively in Lua script.

Nodejs style network API

  • • Event-driven API for network applicaitons, which faciliates developers writing code running on a 5mm*5mm sized MCU in Nodejs style.

  • • Greatly speed up your IOT application developing process.

Lowest cost WI-FI

  • • Less than $2 WI-FI MCU ESP8266 integrated and esay to prototyping development kit.

  • • We provide the best platform for IOT application development at the lowest cost.


SPECIFICATION

The Development Kit based on ESP8266, integates GPIO, PWM, IIC, 1-Wire and ADC all in one board.

Power your developement in the fastest way combinating with NodeMCU Firmware!

  • USB-TTL included, plug&play

  • 10 GPIO, every GPIO can be PWM, I2C, 1-wire

  • PCB antenna


DOCUMENT

Schematic & PCB, Source Code, API Documents










Technical Details

Weight G.W 10g    
Battery Exclude

Part List

NodeMCU v2 1

Line share