├── .gitattributes
├── .gitignore
├── 1_node_soil.lua
├── SSD1306_IP.lua
├── ajax.lua
├── ap.lua
├── app.lua
├── ascii.lua
├── calculator.html
├── coms.lua
├── config.lua
├── dht1.lua
├── dht11.lua
├── dht22.lua
├── dht_lib.lua
├── ds18b20.lua
├── ds3231-example.lua
├── ds3231-web.lua
├── ds3231.lua
├── ds_tem.lua
├── esp8266-projects-master.zip
├── esp8266-projects-master
├── 01d.MONO
├── 02d.MONO
├── 03d.MONO
├── 04d.MONO
├── 09d.MONO
├── 10d.MONO
├── 11d.MONO
├── 13d.MONO
├── 50d.MONO
├── README.md
├── simple-oled-example
│ ├── clouds.png
│ ├── clouds.xbm
│ ├── displayXBM.lua
│ ├── simple-oled-sketch.fzz
│ └── simple-oled-sketch_bb.png
├── temp.MONO
├── temp.gif
├── temp.png
└── weather-station
│ ├── 01d.MONO
│ ├── 01n.xbm
│ ├── 02d.MONO
│ ├── 03d.MONO
│ ├── 04d.MONO
│ ├── 09d.MONO
│ ├── 10d.MONO
│ ├── 11d.MONO
│ ├── 13d.MONO
│ ├── 50d.MONO
│ ├── README.md
│ ├── clouds.xbm
│ ├── init.lua
│ ├── simple-oled-sketch_bb.png
│ ├── src
│ ├── 01d.png
│ ├── 02d.png
│ ├── 03d.png
│ ├── 04d.png
│ ├── 09d.png
│ ├── 10d.png
│ ├── 11d.png
│ ├── 13d.png
│ ├── 50d.png
│ ├── display.jpg
│ └── simple-oled-sketch.fzz
│ ├── temp.XBM
│ └── weatherStation.lua
├── hello.lua
├── http.lua
├── http_bridge.lua
├── http_dimmer.lua
├── http_node.lua
├── htu21df.lua
├── init.lua
├── init_bak.lua
├── iothink.lua
├── iothink.zip
├── iothink_dht11.lua
├── iothink_dimmer.lua
├── iothink_ds1820.lua
├── iothink_relay.lua
├── iothink_relay_lcd.lua
├── iothink_rgb.lua
├── iothink_test.lua
├── iothink_trmp.lua
├── iothink_weather.lua
├── magsw.lua
├── main.lua
├── monDHT11.lua
├── mqtt_client.lua
├── mqtt_dht11.lua
├── mqtt_ds1820.lua
├── mqtt_soil.lua
├── mqtt_test.lua
├── mymodule.lua
├── node_ds1820.lua
├── node_light
├── node_light.lua
├── node_ralay.lua
├── node_secur.lua
├── node_sensor.lua
├── node_soil.lua
├── node_temperature.lua
├── oled.lua
├── oled_test.lua
├── palette.lua
├── palette2.lua
├── pir.lua
├── rgb.lua
├── run.lua
├── sample_http.lua
├── sample_http2.lua
├── sample_http3.lua
├── set_config.lua
├── soil.lua
├── ssd1306.lua
├── ssd13061.lua
├── tcp_client_temp.lua
├── tcp_server_temp.lua
├── thingspeak_dh11.lua
├── thingspeak_dht11.lua
├── thingspeak_ds18B20.lua
├── tinyweb.lua
├── training
├── blinking.lua
├── dht.lua
├── for_1.lua
├── for_2.lua
├── for_3.lua
├── http_server.lua
├── if.lua
├── read_dht.lua
├── tcp_server.lua
├── timer.lua
├── while.lua
└── wifi.lua
├── u8g_graphics_test.lua
├── uart.lua
├── uart_server.lua
├── weatherStation.lua
├── weathericon
├── 01d.MONO
├── 02d.MONO
├── 03d.MONO
├── 04d.MONO
├── 09d.MONO
├── 10d.MONO
├── 11d.MONO
├── 13d.MONO
└── 50d.MONO
├── wifi_sensor.lua
├── www.lua
└── xperia.lua
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
--------------------------------------------------------------------------------
/1_node_soil.lua:
--------------------------------------------------------------------------------
1 | server = "192.168.1.48"
2 | port = 5683
3 | node_name = "Soil-02"
4 | conn=net.createConnection(net.TCP, 0)
5 | gpio.mode(4,gpio.INPUT,gpio.FLOAT)
6 | gpio.mode(5,gpio.INPUT,gpio.FLOAT)
7 | gpio.mode(6,gpio.INPUT,gpio.FLOAT)
8 | soil = "HIGH"
9 | function split(s, delimiter)
10 | result = {};
11 | for match in (s..delimiter):gmatch("(.-)"..delimiter) do
12 | table.insert(result, match);
13 | end
14 | return result;
15 | end
16 |
17 | function open()
18 | print("Open connection...")
19 | conn:on("receive", receive)
20 | conn:on("disconnection", function()
21 | print("Disconnection..")
22 | end);
23 | conn:on("reconnection", function() print("Disconnection..") end);
24 | conn:on("connection", function() print("Connected..") end);
25 | conn:connect(port, server)
26 | conn:send('{ "type": 1, "data": "'.. node.chipid() .. '", "name": "'..node_name..'"}')
27 | end
28 |
29 | function receive(conn, payload)
30 | list=split(payload,"|")
31 | if (list[1] == 'V') then
32 | if (list[2] == 'heap') then
33 | conn:send('{ "type": 2, "data":"'.. node.heap() .. '"}')
34 | end
35 |
36 | if (list[2] == 'soil1') then
37 | soil = "HIGH"
38 | if gpio.read(4)==1 then
39 | soil = "LOW"
40 | end
41 | conn:send('{ "type": 2, "data": { "deviceID": "'..node.chipid()..'", "id": 3, "value": "'..soil..'"}}')
42 | end
43 | end
44 | end
45 |
46 |
47 | status_soil2 = "HIGH"
48 | oldstatus_soil2 = "HIGH"
49 |
50 | function sendalarm(id, status)
51 | conn:send('{ "type": 4, "deviceID": "'.. node.chipid() ..'", "data": {"msg": "'..node_name..' status change", "id": '..id..', "value": "'..status..'"}}')
52 | end
53 |
54 | tmr.alarm(0, 3000, 1, function() -- Set alarm to one second
55 |
56 | if gpio.read(4)==1 then status_soil2="LOW" else status_soil2="HIGH" end
57 | if status_soil2 ~= oldstatus_soil2 then sendalarm (3, status_soil2) end
58 | oldstatus_soil2 = status_soil2
59 | end)
60 |
61 | function close()
62 | conn:close()
63 | end
64 |
65 | tmr.alarm(1, 2000, 1, function()
66 | open()
67 | tmr.stop(1)
68 | end)
69 |
70 |
--------------------------------------------------------------------------------
/SSD1306_IP.lua:
--------------------------------------------------------------------------------
1 |
2 | -- SDA and SCL can be assigned freely to available GPIOs
3 | sda = 3
4 | scl = 4
5 | sla = 0x3c
6 | i2c.setup(0, sda, scl, i2c.SLOW)
7 | disp = u8g.ssd1306_128x64_i2c(sla)
8 | -- graphic test components
9 | disp:setFont(u8g.font_6x10)
10 | disp:setFontRefHeightExtendedText()
11 | disp:setDefaultForegroundColor()
12 | disp:setFontPosTop()
13 | if ssid == nil then ssid = "N/A" end
14 | function init()
15 | disp:firstPage()
16 | repeat
17 | disp:drawStr(40, 10, "NodeMCU")
18 | disp:drawStr(5, 28, "SSID: " .. ssid)
19 | disp:drawStr(15, 47, "Connecting ...")
20 | until disp:nextPage() == false
21 | end
22 | function display()
23 | disp:firstPage()
24 | repeat
25 | disp:drawStr(10, 10, "IP Address:")
26 | disp:drawStr(30, 28, wifi.sta.getip().."")
27 | disp:drawStr(20, 47, "ID: "..node.chipid())
28 | until disp:nextPage() == false
29 | end
30 |
31 |
32 |
--------------------------------------------------------------------------------
/ajax.lua:
--------------------------------------------------------------------------------
1 | pin1=3
2 | pin2=4
3 | gpio.mode(pin1,gpio.OUTPUT)
4 | gpio.mode(pin2,gpio.OUTPUT)
5 | function split(s, delimiter)
6 | result = {};
7 | for match in (s..delimiter):gmatch("(.-)"..delimiter) do
8 | table.insert(result, match);
9 | end
10 | return result;
11 | end
12 | function urlencode(payload)
13 | result = {};
14 | list=split(payload,"\r\n")
15 | --print(list[1])
16 | list=split(list[1]," ")
17 | --print(list[2])
18 | list=split(list[2],"\/")
19 |
20 | table.insert(result, list[1]);
21 | table.insert(result, list[2]);
22 | table.insert(result, list[3]);
23 |
24 | return result;
25 | end
26 |
27 | function sendHeader(conn)
28 | conn:send("HTTP/1.1 200 OK\r\n")
29 | conn:send("Access-Control-Allow-Origin: *\r\n")
30 | conn:send("Content-Type: application/json; charset=utf-8\r\n")
31 | conn:send("Server:NodeMCU\r\n")
32 | conn:send("Connection: close\r\n\r\n")
33 | end
34 |
35 | function index(conn)
36 | conn:send('HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nCache-Control: private, no-store\r\n\r\n\
37 |
\
38 | ESP8266\
39 | \
40 | \
41 | \
47 | \
48 | GPIO3
\
49 | GPIO4
\
50 | ')
51 | end
52 | srv=net.createServer(net.TCP)
53 | srv:listen(80,function(conn)
54 | conn:on("receive",function(conn,payload)
55 | print("Http Request..")
56 | list=urlencode(payload)
57 | if (list[2]=="") then
58 | index(conn)
59 | elseif (list[2]=="write") then
60 | local pin = tonumber(list[3])
61 | local status = tonumber(list[4])
62 | gpio.write(pin, status)
63 | sendHeader(conn)
64 | conn:send("{\"result\":\"ok\",\"digitalPin\": "..pin..", \"status\": "..gpio.read(pin).."}")
65 | elseif (list[2]=="read") then
66 | sendHeader(conn)
67 | conn:send("{\"result\":\"ok\", \"digitalPins\": [{\"digitalPin\": "..pin1..", \"status\": "..gpio.read(pin1).."},{\"digitalPin\": "..pin2..", \"status\": "..gpio.read(pin2).."}]}")
68 | else
69 | sendHeader(conn)
70 | conn:send("{\"result\":\"error\",\"message\": \"command not found\"}")
71 | end
72 | conn:close()
73 | end)
74 | end)
75 |
--------------------------------------------------------------------------------
/ap.lua:
--------------------------------------------------------------------------------
1 | print("set up wifi AP mode")
2 | wifi.setmode(wifi.SOFTAP)
3 | cfg = {}
4 | cfg.ssid = 'ESP8266-'..node.chipid()
5 | cfg.pwd = '1234567890'
6 | wifi.ap.config(cfg)
7 |
8 | tmr.alarm(0, 2000, 0, function()
9 | print ('Start HTTP Server')
10 | dofile('sample_http3.lc')
11 | end)
12 |
--------------------------------------------------------------------------------
/app.lua:
--------------------------------------------------------------------------------
1 |
2 | function split(s, delimiter)
3 | result = {};
4 | for match in (s..delimiter):gmatch("(.-)"..delimiter) do
5 | table.insert(result, match);
6 | end
7 | return result;
8 | end
9 | function urlencode(payload)
10 | result = {};
11 | list=split(payload,"\r\n")
12 | --print(list[1])
13 | list=split(list[1]," ")
14 | --print(list[2])
15 | list=split(list[2],"\/")
16 |
17 | table.insert(result, list[1]);
18 | table.insert(result, list[2]);
19 | table.insert(result, list[3]);
20 |
21 | return result;
22 | end
23 | function sendHeader(conn)
24 | conn:send("HTTP/1.1 200 OK\r\n")
25 | conn:send("Access-Control-Allow-Origin: *\r\n")
26 | conn:send("Content-Type: application/json; charset=utf-8\r\n")
27 | conn:send("Server:NodeMCU\r\n")
28 | conn:send("Connection: close\r\n\r\n")
29 | end
30 | function index(conn)
31 | conn:send('HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nCache-Control: private, no-store\r\n\r\n\
32 | \
33 | ESP8266\
34 | \
35 | \
36 | \
37 | ESP8266 GOIP API
\
38 | ')
39 | end
40 | srv=net.createServer(net.TCP)
41 | srv:listen(80,function(conn)
42 | conn:on("receive",function(conn,payload)
43 | list=urlencode(payload)
44 | if (list[2]=="") then
45 | index(conn)
46 | elseif (list[2]=="write") then
47 | local pin = tonumber(list[3])
48 | --print("Pin: "..pin)
49 | local status = tonumber(list[4])
50 | --print("State: "..status)
51 | gpio.write(pin, status)
52 | -- Response Header
53 | sendHeader(conn)
54 | -- Response Content
55 | conn:send('{"result":"ok","digitalPin": '..pin..', "status": '..gpio.read(pin)..'}')
56 | elseif (list[2]=="read") then
57 | -- Response Header
58 | sendHeader(conn)
59 | -- Response Content
60 | conn:send('{"result":"ok", "digitalPins":[\
61 | {"digitalPin": 4,"status": '..gpio.read(4)..'},\
62 | {"digitalPin": 5, "status": '..gpio.read(5)..'},\
63 | {"digitalPin": 6, "status": '..gpio.read(6)..'},\
64 | {"digitalPin": 7, "status": '..gpio.read(7)..'}\
65 | ]}')
66 | else
67 | -- Response Header
68 | sendHeader(conn)
69 | -- Response Content
70 | conn:send('{"result":"error","message": "command not found"}')
71 | end
72 | conn:close()
73 | end)
74 | end)
75 |
--------------------------------------------------------------------------------
/ascii.lua:
--------------------------------------------------------------------------------
1 | ascii = {}
2 |
3 | ascii[0] = {}
4 | ascii[0][0] = 0x3e
5 | ascii[0][1] = 0x51
6 | ascii[0][2] = 0x49
7 | ascii[0][3] = 0x45
8 | ascii[0][4] = 0x3e
9 |
10 | ascii[1] = {}
11 | ascii[1][0] = 0x00
12 | ascii[1][1] = 0x42
13 | ascii[1][2] = 0x7f
14 | ascii[1][3] = 0x40
15 | ascii[1][4] = 0x00
16 |
17 | ascii[2] = {}
18 | ascii[2][0] = 0x42
19 | ascii[2][1] = 0x61
20 | ascii[2][2] = 0x51
21 | ascii[2][3] = 0x49
22 | ascii[2][4] = 0x46
23 |
24 | ascii[3] = {}
25 | ascii[3][0] = 0x21
26 | ascii[3][1] = 0x41
27 | ascii[3][2] = 0x45
28 | ascii[3][3] = 0x4b
29 | ascii[3][4] = 0x31
30 |
31 | ascii[4] = {}
32 | ascii[4][0] = 0x18
33 | ascii[4][1] = 0x14
34 | ascii[4][2] = 0x12
35 | ascii[4][3] = 0x7f
36 | ascii[4][4] = 0x10
37 |
38 | ascii[5] = {}
39 | ascii[5][0] = 0x27
40 | ascii[5][1] = 0x45
41 | ascii[5][2] = 0x45
42 | ascii[5][3] = 0x45
43 | ascii[5][4] = 0x39
44 |
45 | ascii[6] = {}
46 | ascii[6][0] = 0x3c
47 | ascii[6][1] = 0x4a
48 | ascii[6][2] = 0x49
49 | ascii[6][3] = 0x49
50 | ascii[6][4] = 0x30
51 |
52 | ascii[7] = {}
53 | ascii[7][0] = 0x01
54 | ascii[7][1] = 0x71
55 | ascii[7][2] = 0x09
56 | ascii[7][3] = 0x05
57 | ascii[7][4] = 0x03
58 |
59 | ascii[8] = {}
60 | ascii[8][0] = 0x36
61 | ascii[8][1] = 0x49
62 | ascii[8][2] = 0x49
63 | ascii[8][3] = 0x49
64 | ascii[8][4] = 0x36
65 |
66 | ascii[9] = {}
67 | ascii[9][0] = 0x06
68 | ascii[9][1] = 0x49
69 | ascii[9][2] = 0x49
70 | ascii[9][3] = 0x29
71 | ascii[9][4] = 0x1e
72 |
--------------------------------------------------------------------------------
/calculator.html:
--------------------------------------------------------------------------------
1 |
2 | calculator
3 |
4 |
15 | {{result}}
16 |
17 |
--------------------------------------------------------------------------------
/coms.lua:
--------------------------------------------------------------------------------
1 | ssid = 'Comscicafe'
2 | pwd = 'ArteTalento'
3 | print("set up wifi mode")
4 | wifi.setmode(wifi.STATION)
5 | wifi.sta.config(ssid, pwd)
6 | wifi.sta.connect()
7 | cnt = 0
8 | tmr.alarm(0, 1000, 1, function()
9 | if (wifi.sta.getip() == nil) and (cnt < 200) then
10 | print("IP unavaiable, Waiting...")
11 | cnt = cnt + 1
12 | else
13 | tmr.stop(0)
14 | if (cnt < 20) then
15 | print("Config done, IP is "..wifi.sta.getip())
16 | tmr.alarm(0, 2000, 1, function()
17 | tmr.stop(0)
18 | print("WIFI connected...")
19 | dofile('tcp_client_temp.lc')
20 | --dofile("iothink_relay.lc")
21 | -- dofile("sample_http3.lua")
22 | --dofile("iothink_weather.lc")
23 | end)
24 | else
25 | print("Wifi setup time more than 10s, Please verify wifi.sta.config() function. Then re-download the file.")
26 | end
27 | end
28 | end)
29 |
--------------------------------------------------------------------------------
/config.lua:
--------------------------------------------------------------------------------
1 | see_dum
2 | 0863219053
3 |
--------------------------------------------------------------------------------
/dht1.lua:
--------------------------------------------------------------------------------
1 | pin = 4
2 |
3 | Humidity = 0
4 | HumidityDec=0
5 | Temperature = 0
6 | TemperatureDec=0
7 | Checksum = 0
8 | ChecksumTest=0
9 |
10 |
11 | function getTemp()
12 | Humidity = 0
13 | HumidityDec=0
14 | Temperature = 0
15 | TemperatureDec=0
16 | Checksum = 0
17 | ChecksumTest=0
18 |
19 | --Data stream acquisition timing is critical. There's
20 | --barely enough speed to work with to make this happen.
21 | --Pre-allocate vars used in loop.
22 |
23 | bitStream = {}
24 | for j = 1, 40, 1 do
25 | bitStream[j]=0
26 | end
27 | bitlength=0
28 |
29 | gpio.mode(pin, gpio.OUTPUT)
30 | gpio.write(pin, gpio.LOW)
31 | tmr.delay(20000)
32 | --Use Markus Gritsch trick to speed up read/write on GPIO
33 | gpio_read=gpio.read
34 | gpio_write=gpio.write
35 |
36 | gpio.mode(pin, gpio.INPUT)
37 |
38 | --bus will always let up eventually, don't bother with timeout
39 | while (gpio_read(pin)==0 ) do end
40 |
41 | c=0
42 | while (gpio_read(pin)==1 and c<100) do c=c+1 end
43 |
44 | --bus will always let up eventually, don't bother with timeout
45 | while (gpio_read(pin)==0 ) do end
46 |
47 | c=0
48 | while (gpio_read(pin)==1 and c<100) do c=c+1 end
49 |
50 | --acquisition loop
51 | for j = 1, 40, 1 do
52 | while (gpio_read(pin)==1 and bitlength<10 ) do
53 | bitlength=bitlength+1
54 | end
55 | bitStream[j]=bitlength
56 | bitlength=0
57 | --bus will always let up eventually, don't bother with timeout
58 | while (gpio_read(pin)==0) do end
59 | end
60 |
61 | --DHT data acquired, process.
62 |
63 | for i = 1, 8, 1 do
64 | if (bitStream[i+0] > 2) then
65 | Humidity = Humidity+2^(8-i)
66 | end
67 | end
68 | for i = 1, 8, 1 do
69 | if (bitStream[i+8] > 2) then
70 | HumidityDec = HumidityDec+2^(8-i)
71 | end
72 | end
73 | for i = 1, 8, 1 do
74 | if (bitStream[i+16] > 2) then
75 | Temperature = Temperature+2^(8-i)
76 | end
77 | end
78 | for i = 1, 8, 1 do
79 | if (bitStream[i+24] > 2) then
80 | TemperatureDec = TemperatureDec+2^(8-i)
81 | end
82 | end
83 | for i = 1, 8, 1 do
84 | if (bitStream[i+32] > 2) then
85 | Checksum = Checksum+2^(8-i)
86 | end
87 | end
88 | ChecksumTest=(Humidity+HumidityDec+Temperature+TemperatureDec) % 0xFF
89 |
90 | print ("Temperature: "..Temperature.."."..TemperatureDec)
91 | print ("Humidity: "..Humidity.."."..HumidityDec)
92 | print ("ChecksumReceived: "..Checksum)
93 | print ("ChecksumTest: "..ChecksumTest)
94 | end
--------------------------------------------------------------------------------
/dht11.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- DHT11 module for NODEMCU
3 | -- LICENCE: http://opensource.org/licenses/MIT
4 | -- zlo2k from code Pigs Fly
5 | --------------------------------------------------------------------------------
6 | local moduleName = "dht11"
7 | local M = {}
8 | _G[moduleName] = M
9 |
10 | local temp = 0
11 | local hum = 0
12 | local bitStream = {}
13 |
14 | function M.init(pin)
15 | bitStream = {}
16 | for j = 1, 40, 1 do
17 | bitStream[j] = 0
18 | end
19 | bitlength = 0
20 |
21 | gpio.mode(pin, gpio.OUTPUT)
22 | gpio.write(pin, gpio.LOW)
23 | tmr.delay(20000)
24 | --Use Markus Gritsch trick to speed up read/write on GPIO
25 | gpio_read = gpio.read
26 | gpio_write = gpio.write
27 |
28 | gpio.mode(pin, gpio.INPUT)
29 |
30 | while (gpio_read(pin) == 0) do end
31 |
32 | c = 0
33 | while (gpio_read(pin) == 1 and c < 100) do c = c + 1 end
34 |
35 | while (gpio_read(pin) == 0) do end
36 |
37 | c = 0
38 | while (gpio_read(pin) == 1 and c < 100) do c = c + 1 end
39 |
40 | for j = 1, 40, 1 do
41 | while (gpio_read(pin) == 1 and bitlength < 10) do
42 | bitlength = bitlength + 1
43 | end
44 | bitStream[j] = bitlength
45 | bitlength = 0
46 | while (gpio_read(pin) == 0) do end
47 | end
48 |
49 | hum = 0
50 | temp = 0
51 |
52 | for i = 1, 8, 1 do
53 | if (bitStream[i + 0] > 2) then
54 | hum = hum + 2 ^ (8 - i)
55 | end
56 | end
57 | for i = 1, 8, 1 do
58 | if (bitStream[i + 16] > 2) then
59 | temp = temp + 2 ^ (8 - i)
60 | end
61 | end
62 | bitStream = {}
63 | gpio_read = nil
64 | gpio_write = nil
65 | end
66 |
67 | function M.getTemp()
68 | return temp
69 | end
70 |
71 | function M.getHumidity()
72 | return hum
73 | end
74 |
75 | return M
76 |
--------------------------------------------------------------------------------
/dht22.lua:
--------------------------------------------------------------------------------
1 | ------------------------------------------------------------------------------
2 | -- DHT11/22 query module
3 | --
4 | -- LICENCE: http://opensource.org/licenses/MIT
5 | -- Vladimir Dronnikov
6 | --
7 | -- Example:
8 | -- print("DHT11", dofile("dht22.lua").read(4))
9 | -- print("DHT22", dofile("dht22.lua").read(4, true))
10 | -- NB: the very first read sometimes fails
11 | ------------------------------------------------------------------------------
12 | local M
13 | do
14 | -- cache
15 | local gpio = gpio
16 | local val = gpio.read
17 | local waitus = tmr.delay
18 | --
19 | local read = function(pin, dht22)
20 | -- wait for pin value
21 | local w = function(v)
22 | local c = 255
23 | while c > 0 and val(pin) ~= v do c = c - 1 end
24 | return c
25 | end
26 | -- NB: we preallocate incoming data buffer
27 | -- or precise timing in reader gets broken
28 | local b = { 0, 0, 0, 0, 0 }
29 |
30 | -- kick the device
31 | gpio.mode(pin, gpio.INPUT, gpio.PULLUP)
32 | gpio.write(pin, 1)
33 | waitus(10)
34 | gpio.mode(pin, gpio.OUTPUT)
35 | gpio.write(pin, 0)
36 | waitus(20000)
37 | gpio.write(pin, 1)
38 | gpio.mode(pin, gpio.INPUT, gpio.PULLUP)
39 | -- wait for device presense
40 | if w(0) == 0 or w(1) == 0 or w(0) == 0 then
41 | return nil, 0
42 | end
43 | -- receive 5 octets of data, msb first
44 | for i = 1, 5 do
45 | local x = 0
46 | for j = 1, 8 do
47 | x = x + x
48 | if w(1) == 0 then return nil, 1 end
49 | -- 70us for 1, 27 us for 0
50 | waitus(30)
51 | if val(pin) == 1 then
52 | x = x + 1
53 | if w(0) == 0 then return nil, 2 end
54 | end
55 | end
56 | b[i] = x
57 | end
58 | -- check crc. NB: calculating in receiver loop breaks timings
59 | local crc = 0
60 | for i = 1, 4 do
61 | crc = (crc + b[i]) % 256
62 | end
63 | if crc ~= b[5] then return nil, 3 end
64 | -- convert
65 | local t, h
66 | -- DHT22: values in tenths of unit, temperature can be negative
67 | if dht22 then
68 | h = b[1] * 256 + b[2]
69 | t = b[3] * 256 + b[4]
70 | if t > 0x8000 then t = -(t - 0x8000) end
71 | -- DHT11: no negative temperatures, only integers
72 | -- NB: return in 0.1 Celsius
73 | else
74 | h = 10 * b[1]
75 | t = 10 * b[3]
76 | end
77 | return t, h
78 | end
79 | -- expose interface
80 | M = {
81 | read = read,
82 | }
83 | end
84 | return M
--------------------------------------------------------------------------------
/dht_lib.lua:
--------------------------------------------------------------------------------
1 | local moduleName = 'dht_lib'
2 | local M = {}
3 | _G[moduleName] = M
4 | local humidity
5 | local temperature
6 | local bitStream = {}
7 |
8 | local function read(pin)
9 | local bitlength = 0
10 | humidity = 0
11 | temperature = 0
12 | local gpio_read = gpio.read
13 | for j = 1, 40, 1 do
14 | bitStream[j] = 0
15 | end
16 | gpio.mode(pin, gpio.OUTPUT)
17 | gpio.write(pin, gpio.HIGH)
18 | tmr.delay(100)
19 | gpio.write(pin, gpio.LOW)
20 | tmr.delay(20000)
21 | gpio.write(pin, gpio.HIGH)
22 | gpio.mode(pin, gpio.INPUT)
23 | while (gpio_read(pin) == 0 ) do end
24 | local c=0
25 | while (gpio_read(pin) == 1 and c < 500) do c = c + 1 end
26 |
27 | while (gpio_read(pin) == 0 ) do end
28 | c=0
29 | while (gpio_read(pin) == 1 and c < 500) do c = c + 1 end
30 |
31 | for j = 1, 40, 1 do
32 | while (gpio_read(pin) == 1 and bitlength < 10 ) do
33 | bitlength = bitlength + 1
34 | end
35 | bitStream[j] = bitlength
36 | bitlength = 0
37 |
38 | while (gpio_read(pin) == 0) do end
39 | end
40 | end
41 | function M.read11(pin)
42 | read(pin)
43 | local checksum = 0
44 | local checksumTest
45 | for i = 1, 8, 1 do -- Byte[0]
46 | if (bitStream[i] > 3) then
47 | humidity = humidity + 2 ^ (8 - i)
48 | end
49 | end
50 | for i = 1, 8, 1 do -- Byte[2]
51 | if (bitStream[i + 16] > 3) then
52 | temperature = temperature + 2 ^ (8 - i)
53 | end
54 | end
55 | for i = 1, 8, 1 do --Byte[4]
56 | if (bitStream[i + 32] > 3) then
57 | checksum = checksum + 2 ^ (8 - i)
58 | end
59 | end
60 |
61 | if(checksum ~= humidity+temperature) then
62 | humidity = nil
63 | temperature = nil
64 | end
65 |
66 | end
67 | function M.read22( pin )
68 | read(pin)
69 | local checksum = 0
70 | local checksumTest
71 | for i = 1, 16, 1 do
72 | if (bitStream[i] > 3) then
73 | humidity = humidity + 2 ^ (16 - i)
74 | end
75 | end
76 | for i = 1, 16, 1 do
77 | if (bitStream[i + 16] > 3) then
78 | temperature = temperature + 2 ^ (16 - i)
79 | end
80 | end
81 | for i = 1, 8, 1 do
82 | if (bitStream[i + 32] > 3) then
83 | checksum = checksum + 2 ^ (8 - i)
84 | end
85 | end
86 | checksumTest = (bit.band(humidity, 0xFF) + bit.rshift(humidity, 8) + bit.band(temperature, 0xFF) + bit.rshift(temperature, 8))
87 | checksumTest = bit.band(checksumTest, 0xFF)
88 | if temperature > 0x8000 then
89 | temperature = -(temperature - 0x8000)
90 | end
91 | if (checksumTest - checksum >= 1) or (checksum - checksumTest >= 1) then
92 | humidity = nil
93 | end
94 | end
95 |
96 | function M.getTemperature()
97 | return temperature
98 | end
99 |
100 | function M.getHumidity()
101 | return humidity
102 | end
103 |
104 | return M
105 |
--------------------------------------------------------------------------------
/ds18b20.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- DS18B20 one wire module for NODEMCU
3 | -- NODEMCU TEAM
4 | -- LICENCE: http://opensource.org/licenses/MIT
5 | -- Vowstar
6 | --------------------------------------------------------------------------------
7 | -- Set module name as parameter of require
8 | local modname = "ds18b20"
9 | local M = {}
10 | _G[modname] = M
11 | --------------------------------------------------------------------------------
12 | -- Local used variables
13 | --------------------------------------------------------------------------------
14 | -- DS18B20 dq pin
15 | local pin = nil
16 | --------------------------------------------------------------------------------
17 | -- Local used modules
18 | --------------------------------------------------------------------------------
19 | -- Table module
20 | local table = table
21 | -- String module
22 | local string = string
23 | -- One wire module
24 | local ow = ow
25 | -- Timer module
26 | local tmr = tmr
27 | -- Limited to local environment
28 | setfenv(1,M)
29 | --------------------------------------------------------------------------------
30 | -- Implementation
31 | --------------------------------------------------------------------------------
32 | C = 0
33 | F = 1
34 | K = 2
35 | function read(pin)
36 | result = nil
37 | ow.setup(pin)
38 | flag = false
39 | if(addr == nil) then
40 | ow.reset_search(pin)
41 | count = 0
42 | repeat
43 | count = count + 1
44 | addr = ow.search(pin)
45 | tmr.wdclr()
46 | until((addr ~= nil) or (count > 100))
47 | ow.reset_search(pin)
48 | end
49 | if(addr == nil) then
50 | return result
51 | end
52 | crc = ow.crc8(string.sub(addr,1,7))
53 | if (crc == addr:byte(8)) then
54 | if ((addr:byte(1) == 0x10) or (addr:byte(1) == 0x28)) then
55 | -- print("Device is a DS18S20 family device.")
56 | ow.reset(pin)
57 | ow.select(pin, addr)
58 | ow.write(pin, 0x44, 1)
59 | -- tmr.delay(1000000)
60 | present = ow.reset(pin)
61 | ow.select(pin, addr)
62 | ow.write(pin,0xBE,1)
63 | -- print("P="..present)
64 | data = nil
65 | data = string.char(ow.read(pin))
66 | for i = 1, 8 do
67 | data = data .. string.char(ow.read(pin))
68 | end
69 | -- print(data:byte(1,9))
70 | crc = ow.crc8(string.sub(data,1,8))
71 | -- print("CRC="..crc)
72 | if (crc == data:byte(9)) then
73 | if(unit == nil or unit == C) then
74 | t = (data:byte(1) + data:byte(2) * 256) * 625
75 | elseif(unit == F) then
76 | t = (data:byte(1) + data:byte(2) * 256) * 1125 + 320000
77 | elseif(unit == K) then
78 | t = (data:byte(1) + data:byte(2) * 256) * 625 + 2731500
79 | else
80 | return nil
81 | end
82 | t = t / 10000
83 | -- print("Temperature="..t1.."."..t2.." Centigrade")
84 | -- result = t1.."."..t2
85 | return t
86 | end
87 | tmr.wdclr()
88 | else
89 | -- print("Device family is not recognized.")
90 | end
91 | else
92 | -- print("CRC is not valid!")
93 | end
94 | return result
95 | end
96 |
97 | -- Return module table
98 | return M
99 |
--------------------------------------------------------------------------------
/ds3231-example.lua:
--------------------------------------------------------------------------------
1 | require("ds3231")
2 |
3 | -- ESP-01 GPIO Mapping
4 | gpio0, gpio2 = 3, 4
5 |
6 | ds3231.init(gpio0, gpio2)
7 |
8 | second, minute, hour, day, date, month, year = ds3231.getTime();
9 |
10 | -- Get current time
11 | print(string.format("Time & Date: %s:%s:%s %s/%s/%s", hour, minute, second, date, month, year))
12 |
13 | -- Don't forget to release it after use
14 | ds3231 = nil
15 | package.loaded["ds3231"]=nil
--------------------------------------------------------------------------------
/ds3231-web.lua:
--------------------------------------------------------------------------------
1 | require('ds3231')
2 |
3 | port = 80
4 |
5 | -- ESP-01 GPIO Mapping
6 | gpio0, gpio2 = 3, 4
7 |
8 | days = {
9 | [1] = "Sunday",
10 | [2] = "Monday",
11 | [3] = "Tuesday",
12 | [4] = "Wednesday",
13 | [5] = "Thursday",
14 | [6] = "Friday",
15 | [7] = "Saturday"
16 | }
17 |
18 | months = {
19 | [1] = "January",
20 | [2] = "Febuary",
21 | [3] = "March",
22 | [4] = "April",
23 | [5] = "May",
24 | [6] = "June",
25 | [7] = "July",
26 | [8] = "August",
27 | [9] = "September",
28 | [10] = "October",
29 | [11] = "November",
30 | [12] = "December"
31 | }
32 |
33 | ds3231.init(gpio0, gpio2)
34 |
35 | srv=net.createServer(net.TCP)
36 | srv:listen(port,
37 | function(conn)
38 |
39 | second, minute, hour, day, date, month, year = ds3231.getTime()
40 | prettyTime = string.format("%s, %s %s %s %s:%s:%s", days[day], date, months[month], year, hour, minute, second)
41 |
42 | conn:send("HTTP/1.1 200 OK\nContent-Type: text/html\nRefresh: 5\n\n" ..
43 | "" ..
44 | "" ..
45 | "ESP8266" ..
46 | "Time and Date: " .. prettyTime .. "
" ..
47 | "Node ChipID : " .. node.chipid() .. "
" ..
48 | "Node MAC : " .. wifi.sta.getmac() .. "
" ..
49 | "Node Heap : " .. node.heap() .. "
" ..
50 | "Timer Ticks : " .. tmr.now() .. "
" ..
51 | "")
52 | conn:on("sent",function(conn) conn:close() end)
53 | end
54 | )
--------------------------------------------------------------------------------
/ds3231.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- DS3231 I2C module for NODEMCU
3 | -- NODEMCU TEAM
4 | -- LICENCE: http://opensource.org/licenses/MIT
5 | -- Tobie Booth
6 | --------------------------------------------------------------------------------
7 |
8 | local moduleName = 'ds3231'
9 | local M = {}
10 | _G[moduleName] = M
11 |
12 | -- Default value for i2c communication
13 | local id = 0
14 |
15 | --device address
16 | local dev_addr = 0x68
17 |
18 | local function decToBcd(val)
19 | return((((val/10) - ((val/10)%1)) *16) + (val%10))
20 | end
21 |
22 | local function bcdToDec(val)
23 | return((((val/16) - ((val/16)%1)) *10) + (val%16))
24 | end
25 |
26 | -- initialize i2c
27 | --parameters:
28 | --d: sda
29 | --l: scl
30 | function M.init(d, l)
31 | if (d ~= nil) and (l ~= nil) and (d >= 0) and (d <= 11) and (l >= 0) and ( l <= 11) and (d ~= l) then
32 | sda = d
33 | scl = l
34 | else
35 | print("iic config failed!") return nil
36 | end
37 | print("init done")
38 | i2c.setup(id, sda, scl, i2c.SLOW)
39 | end
40 |
41 | --get time from DS3231
42 | function M.getTime()
43 | i2c.start(id)
44 | i2c.address(id, dev_addr, i2c.TRANSMITTER)
45 | i2c.write(id, 0x00)
46 | i2c.stop(id)
47 | i2c.start(id)
48 | i2c.address(id, dev_addr, i2c.RECEIVER)
49 | local c=i2c.read(id, 7)
50 | i2c.stop(id)
51 | return bcdToDec(tonumber(string.byte(c, 1))),
52 | bcdToDec(tonumber(string.byte(c, 2))),
53 | bcdToDec(tonumber(string.byte(c, 3))),
54 | bcdToDec(tonumber(string.byte(c, 4))),
55 | bcdToDec(tonumber(string.byte(c, 5))),
56 | bcdToDec(tonumber(string.byte(c, 6))),
57 | bcdToDec(tonumber(string.byte(c, 7)))
58 | end
59 |
60 | --set time for DS3231
61 | function M.setTime(second, minute, hour, day, date, month, year)
62 | i2c.start(id)
63 | i2c.address(id, dev_addr, i2c.TRANSMITTER)
64 | i2c.write(id, 0x00)
65 | i2c.write(id, decToBcd(second))
66 | i2c.write(id, decToBcd(minute))
67 | i2c.write(id, decToBcd(hour))
68 | i2c.write(id, decToBcd(day))
69 | i2c.write(id, decToBcd(date))
70 | i2c.write(id, decToBcd(month))
71 | i2c.write(id, decToBcd(year))
72 | i2c.stop(id)
73 | end
74 |
75 | return M
--------------------------------------------------------------------------------
/ds_tem.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- DS18B20 one wire module for NODEMCU
3 | -- NODEMCU TEAM
4 | -- LICENCE: http://opensource.org/licenses/MIT
5 | -- Vowstar
6 | --------------------------------------------------------------------------------
7 | -- Set module name as parameter of require
8 | local modname = "ds18b20"
9 | local M = {}
10 | _G[modname] = M
11 | --------------------------------------------------------------------------------
12 | -- Local used variables
13 | --------------------------------------------------------------------------------
14 | -- DS18B20 dq pin
15 | local pin = nil
16 | -- DS18B20 default pin
17 | local defaultPin = 9
18 | --------------------------------------------------------------------------------
19 | -- Local used modules
20 | --------------------------------------------------------------------------------
21 | -- Table module
22 | local table = table
23 | -- String module
24 | local string = string
25 | -- One wire module
26 | local ow = ow
27 | -- Timer module
28 | local tmr = tmr
29 | -- Limited to local environment
30 | setfenv(1,M)
31 | --------------------------------------------------------------------------------
32 | -- Implementation
33 | --------------------------------------------------------------------------------
34 | C = 0
35 | F = 1
36 | K = 2
37 | function setup(dq)
38 | pin = dq
39 | if(pin == nil) then
40 | pin = defaultPin
41 | end
42 | ow.setup(pin)
43 | end
44 |
45 | function addrs()
46 | setup(pin)
47 | tbl = {}
48 | ow.reset_search(pin)
49 | repeat
50 | addr = ow.search(pin)
51 | if(addr ~= nil) then
52 | table.insert(tbl, addr)
53 | end
54 | tmr.wdclr()
55 | until (addr == nil)
56 | ow.reset_search(pin)
57 | return tbl
58 | end
59 | function readNumber(addr, unit)
60 | result = nil
61 | setup(pin)
62 | flag = false
63 | if(addr == nil) then
64 | ow.reset_search(pin)
65 | count = 0
66 | repeat
67 | count = count + 1
68 | addr = ow.search(pin)
69 | tmr.wdclr()
70 | until((addr ~= nil) or (count > 100))
71 | ow.reset_search(pin)
72 | end
73 | if(addr == nil) then
74 | return result
75 | end
76 | crc = ow.crc8(string.sub(addr,1,7))
77 | if (crc == addr:byte(8)) then
78 | if ((addr:byte(1) == 0x10) or (addr:byte(1) == 0x28)) then
79 | -- print("Device is a DS18S20 family device.")
80 | ow.reset(pin)
81 | ow.select(pin, addr)
82 | ow.write(pin, 0x44, 1)
83 | -- tmr.delay(1000000)
84 | present = ow.reset(pin)
85 | ow.select(pin, addr)
86 | ow.write(pin,0xBE,1)
87 | -- print("P="..present)
88 | data = nil
89 | data = string.char(ow.read(pin))
90 | for i = 1, 8 do
91 | data = data .. string.char(ow.read(pin))
92 | end
93 | -- print(data:byte(1,9))
94 | crc = ow.crc8(string.sub(data,1,8))
95 | -- print("CRC="..crc)
96 | if (crc == data:byte(9)) then
97 | if(unit == nil or unit == C) then
98 | t = (data:byte(1) + data:byte(2) * 256) * 625
99 | elseif(unit == F) then
100 | t = (data:byte(1) + data:byte(2) * 256) * 1125 + 320000
101 | elseif(unit == K) then
102 | t = (data:byte(1) + data:byte(2) * 256) * 625 + 2731500
103 | else
104 | return nil
105 | end
106 | t = t / 10000
107 | -- print("Temperature="..t1.."."..t2.." Centigrade")
108 | -- result = t1.."."..t2
109 | return t
110 | end
111 | tmr.wdclr()
112 | else
113 | -- print("Device family is not recognized.")
114 | end
115 | else
116 | -- print("CRC is not valid!")
117 | end
118 | return result
119 | end
120 |
121 | function read(addr, unit)
122 | t = readNumber(addr, unit)
123 | if (t == nil) then
124 | return nil
125 | else
126 | return t
127 | end
128 | end
129 |
130 | -- Return module table
131 | return M
132 |
--------------------------------------------------------------------------------
/esp8266-projects-master.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master.zip
--------------------------------------------------------------------------------
/esp8266-projects-master/01d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/01d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/02d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/02d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/03d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/03d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/04d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/04d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/09d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/09d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/10d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/10d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/11d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/11d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/13d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/13d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/50d.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/50d.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/README.md:
--------------------------------------------------------------------------------
1 | # esp8266-projects
2 |
3 | Collection of projects for the ESP8266. Have a look at the projects for more detailed instructions or go to http://blog.squix.ch
4 |
--------------------------------------------------------------------------------
/esp8266-projects-master/simple-oled-example/clouds.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/simple-oled-example/clouds.png
--------------------------------------------------------------------------------
/esp8266-projects-master/simple-oled-example/clouds.xbm:
--------------------------------------------------------------------------------
1 | #define clouds_width 60
2 | #define clouds_height 60
3 | static unsigned short clouds_bits[] = {
4 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
5 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
6 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
7 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xf000, 0x000f, 0x0000,
8 | 0x0000, 0xfe00, 0x007f, 0x0000, 0x0000, 0xff80, 0x01ff, 0x0000, 0x0000,
9 | 0xffc0, 0x07ff, 0x0000, 0x0000, 0xffe0, 0x0fff, 0x0000, 0x0000, 0x1ff0,
10 | 0x1ff8, 0x0000, 0x0000, 0x07f8, 0x3fc0, 0x0000, 0x0000, 0x01fc, 0x7f00,
11 | 0x0000, 0x0000, 0x00fe, 0x7e00, 0x0000, 0x0000, 0x007e, 0xfc00, 0x0000,
12 | 0xe000, 0x003f, 0xf800, 0x0001, 0xfc00, 0x001f, 0xf800, 0x0001, 0xff00,
13 | 0x001f, 0xf000, 0x0001, 0xff80, 0x000f, 0xf000, 0x0003, 0xffc0, 0x000f,
14 | 0xe000, 0x0003, 0x3fe0, 0x000c, 0xe000, 0x0003, 0x07f0, 0x0000, 0xe000,
15 | 0x000f, 0x03f0, 0x0000, 0xe000, 0x001f, 0x01f8, 0x0000, 0xe000, 0x003f,
16 | 0x00f8, 0x0000, 0xe000, 0x007f, 0x00fc, 0x0000, 0xa000, 0x00ff, 0x007c,
17 | 0x0000, 0x0000, 0x01fc, 0x007c, 0x0000, 0x0000, 0x01f8, 0x007c, 0x0000,
18 | 0x0000, 0x01f0, 0x007c, 0x0000, 0x0000, 0x03f0, 0x007c, 0x0000, 0x0000,
19 | 0x03e0, 0x007c, 0x0000, 0x0000, 0x03e0, 0x00fc, 0x0000, 0x0000, 0x03e0,
20 | 0x00f8, 0x0000, 0x0000, 0x03e0, 0x01f8, 0x0000, 0x0000, 0x03f0, 0x03f8,
21 | 0x0000, 0x0000, 0x01f0, 0x07f0, 0x01c0, 0x0703, 0x01f8, 0x1fe0, 0x81c0,
22 | 0x0703, 0x00fe, 0xffc0, 0xc0e3, 0xe383, 0x00ff, 0xff80, 0xc0f1, 0xe3c1,
23 | 0x007f, 0xff00, 0xe0f0, 0xe3c1, 0x003f, 0xfe00, 0xe0f8, 0xe1e1, 0x000f,
24 | 0x7000, 0xf078, 0xf1f0, 0x0003, 0x0000, 0xf87c, 0x01f0, 0x0000, 0x0000,
25 | 0xf87e, 0x00f8, 0x0000, 0x0000, 0x7c3e, 0x00f8, 0x0000, 0x0000, 0x7e3e,
26 | 0x00f8, 0x0000, 0x0000, 0x3e1c, 0x0070, 0x0000, 0x0000, 0x3e00, 0x0000,
27 | 0x0000, 0x0000, 0x3e00, 0x0000, 0x0000, 0x0000, 0x0c00, 0x0000, 0x0000,
28 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
29 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
30 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
31 |
--------------------------------------------------------------------------------
/esp8266-projects-master/simple-oled-example/displayXBM.lua:
--------------------------------------------------------------------------------
1 |
2 | -- setup I2c and connect display
3 | function init_i2c_display()
4 | -- SDA and SCL can be assigned freely to available GPIOs
5 | sda = 3 -- GPIO14
6 | scl = 4 -- GPIO12
7 | sla = 0x3c
8 | i2c.setup(0, sda, scl, i2c.SLOW)
9 | disp = u8g.ssd1306_128x64_i2c(sla)
10 | end
11 |
12 | function xbm_picture()
13 | disp:setFont(u8g.font_6x10)
14 | disp:drawStr( 0, 62, "Rainy 8C")
15 | disp:drawXBM( 0, -5, 60, 60, xbm_data )
16 | end
17 |
18 | function bitmap_test(delay)
19 | file.open("13d.MONO", "r")
20 | xbm_data = file.read()
21 | file.close()
22 |
23 | disp:firstPage()
24 | repeat
25 | xbm_picture()
26 | until disp:nextPage() == false
27 |
28 | tmr.wdclr()
29 | end
30 |
31 | init_i2c_display()
32 | bitmap_test()
33 |
--------------------------------------------------------------------------------
/esp8266-projects-master/simple-oled-example/simple-oled-sketch.fzz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/simple-oled-example/simple-oled-sketch.fzz
--------------------------------------------------------------------------------
/esp8266-projects-master/simple-oled-example/simple-oled-sketch_bb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/simple-oled-example/simple-oled-sketch_bb.png
--------------------------------------------------------------------------------
/esp8266-projects-master/temp.MONO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/temp.MONO
--------------------------------------------------------------------------------
/esp8266-projects-master/temp.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/temp.gif
--------------------------------------------------------------------------------
/esp8266-projects-master/temp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/db4linq/lua/031e30e81ab53c871f6e7ee12d810258809fc9cb/esp8266-projects-master/temp.png
--------------------------------------------------------------------------------
/esp8266-projects-master/weather-station/01d.MONO:
--------------------------------------------------------------------------------
1 | ` � � � � � � p � � � � � � � � � � ~ ��> ��� ��? �� �� �� � � ~ � > � � � � � ��? � �� � �� � ��? � � > � > � | � �� �� ��� ��? ��� ��> �p ~ � � � � � � x � � � � � � � � � `
2 |
--------------------------------------------------------------------------------
/esp8266-projects-master/weather-station/01n.xbm:
--------------------------------------------------------------------------------
1 | ` � � � � � � p � � � � � � � � � � ~ ��> ��� ��? �� �� �� � � ~ � > � � � � � ��? � �� � �� � ��? � � > � > � | � �� �� ��� ��? ��� ��> �p ~ � � � � � � x � � � � � � � � � `
2 |
--------------------------------------------------------------------------------
/esp8266-projects-master/weather-station/02d.MONO:
--------------------------------------------------------------------------------
1 | <