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