Changes for page NodeMCU

Last modified by Leon Poon on 2021/01/20 22:58

From version 2.1
edited by Leon Poon
on 2021/01/20 14:06
Change comment: Uploaded new attachment "back.jpg", version {1}
To version 4.1
edited by Leon Poon
on 2021/01/20 14:15
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +NodeMCU
Parent
... ... @@ -1,0 +1,1 @@
1 +Main.WebHome
Content
... ... @@ -1,0 +1,116 @@
1 +Nodemcu V3 Lua WiFi module integrated ESP8266 + additional memory 32Mbit FLASH, USB serial port CP2102
2 +
3 +{{code language="ini" title="platformio.ini"}}
4 +[env:nodemcuv2]
5 +platform = espressif8266
6 +board = nodemcuv2
7 +framework = arduino
8 +lib_deps = arduino-libraries/NTPClient@^3.1.0
9 +
10 +{{/code}}
11 +
12 +Blink all GPIO pin and NTP (uses [[https:~~/~~/platformio.org/lib/show/551/NTPClient/>>https://platformio.org/lib/show/551/NTPClient/]]):
13 +
14 +{{code language="c++" title="main.cpp"}}
15 +#include <Arduino.h>
16 +#include <ESP8266WiFi.h>
17 +#include <WiFiUdp.h>
18 +#include <NTPClient.h>
19 +const char *ssid = "<ssid>";
20 +const char *password = "<wpa_password>";
21 +
22 +WiFiUDP ntpUDP;
23 +
24 +NTPClient timeClient(ntpUDP, "ntp-b.nist.gov", 0, 60000);
25 +
26 +
27 +void setup() {
28 + for (uint8_t i = 0; i <= 5; i++)
29 + pinMode(i, OUTPUT);
30 + for (uint8_t i = 12; i <= 16; i++)
31 + pinMode(i, OUTPUT);
32 +
33 + // Serial.begin(115200);
34 +
35 + WiFi.begin(ssid, password);
36 +
37 + while ( WiFi.status() != WL_CONNECTED ) {
38 + delay ( 500 );
39 + // Serial.print ( "." );
40 + }
41 +
42 +
43 + timeClient.begin();
44 +}
45 +
46 +
47 +unsigned long t;
48 +
49 +
50 +void f(uint8_t hl) {
51 + timeClient.update();
52 + unsigned long t1;
53 + for (; (t1 = timeClient.getEpochTime()) == t; delay(1));
54 +
55 + t = t1;
56 + // Serial.println(timeClient.getFormattedTime());
57 +
58 + for (uint8_t i = 0; i <= 5; i++)
59 + digitalWrite(i, hl);
60 + for (uint8_t i = 12; i <= 16; i++)
61 + digitalWrite(i, hl);
62 +}
63 +
64 +void loop() {
65 + f(HIGH);
66 + f(LOW);
67 +}
68 +
69 +{{/code}}
70 +
71 +{{code language="none" title="Upload log"}}
72 +Configuring upload protocol...
73 +AVAILABLE: espota, esptool
74 +CURRENT: upload_protocol = esptool
75 +Looking for upload port...
76 +Auto-detected: /dev/ttyUSB0
77 +Uploading .pio/build/nodemcuv2/firmware.bin
78 +esptool.py v2.8
79 +Serial port /dev/ttyUSB0
80 +Connecting....
81 +Chip is ESP8266EX
82 +Features: WiFi
83 +Crystal is 26MHz
84 +MAC: AA:BB:CC:DD:EE:FF
85 +Uploading stub...
86 +Running stub...
87 +Stub running...
88 +Configuring flash size...
89 +Auto-detected Flash size: 4MB
90 +Compressed 269888 bytes to 199316...
91 +
92 +Writing at 0x00000000... (7 %)
93 +Writing at 0x00004000... (15 %)
94 +Writing at 0x00008000... (23 %)
95 +Writing at 0x0000c000... (30 %)
96 +Writing at 0x00010000... (38 %)
97 +Writing at 0x00014000... (46 %)
98 +Writing at 0x00018000... (53 %)
99 +Writing at 0x0001c000... (61 %)
100 +Writing at 0x00020000... (69 %)
101 +Writing at 0x00024000... (76 %)
102 +Writing at 0x00028000... (84 %)
103 +Writing at 0x0002c000... (92 %)
104 +Writing at 0x00030000... (100 %)
105 +Wrote 269888 bytes (199316 compressed) at 0x00000000 in 17.6 seconds (effective 122.6 kbit/s)...
106 +Hash of data verified.
107 +
108 +Leaving...
109 +Hard resetting via RTS pin...
110 +{{/code}}
111 +
112 +{{gallery}}
113 +image:front.jpg
114 +
115 +image:back.jpg
116 +{{/gallery}}
back.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -156.4 KB
1 +947.2 KB
Content