#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 64
// For led chips like WS2812, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
// Clock pin only needed for SPI based chipsets when not using hardware SPI
#define DATA_PIN 2
// Define the array of leds
CRGB leds[NUM_LEDS];
byte strip[] = {0,0,0,183,62,67,183,62,67,183,62,67,0,0,0,0,0,0,0,0,0,0,0,0,246,211,45,0,0,0,183,62,67,183,62,67,183,62,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,62,67,183,62,67,183,62,67,183,62,67,0,0,0,0,0,0,0,0,0,0,0,0,246,245,244,246,245,244,246,245,244,246,245,244,0,0,0,0,0,0,0,0,0,0,0,0,226,142,142,0,0,0,226,142,142,0,0,0,226,142,142,0,0,0,0,0,0,0,0,0,226,142,142,226,142,142,226,142,142,226,142,142,226,142,142,0,0,0,0,0,0,0,0,0,246,245,244,246,245,244,246,245,244,246,245,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,246,245,244,246,245,244,0,0,0,0,0,0,0,0,0};
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "Wokwi-GUEST";
const char* password = "";
//Your Domain name with URL path or IP address with path
String serverName = "https://www.google.it";
// the following variables are unsigned longs because the time, measured in
// milliseconds, will quickly become a bigger number than can be stored in an int.
unsigned long lastTime = 0;
// Timer set to 10 minutes (600000)
//unsigned long timerDelay = 600000;
// Set timer to 5 seconds (5000)
unsigned long timerDelay = 60000;
void setup() {
Serial.begin(115200);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
WiFi.begin(ssid, password);
Serial.println("Connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to WiFi network with IP Address: ");
Serial.println(WiFi.localIP());
Serial.println("Timer set to 5 seconds it will take 5 seconds");
}
void loop() {
for(int i=0, p=0;i<NUM_LEDS*3;i+=3,p++){
byte r = strip[i];
byte g = strip[i+1];
byte b = strip[i+2];
leds[p] = CRGB(r, g, b);
}
FastLED.show(); // This sends the updated pixel color to the hardware.
//Send an HTTP POST request every 1 minute
if ((millis() - lastTime) > timerDelay) {
//Check WiFi connection status
if(WiFi.status()== WL_CONNECTED){
HTTPClient http;
String serverPath = serverName + "";
// Your Domain name with URL path or IP address with path
http.begin(serverPath.c_str());
// If you need Node-RED/server authentication, insert user and password below
//http.setAuthorization("REPLACE_WITH_SERVER_USERNAME", "REPLACE_WITH_SERVER_PASSWORD");
// Send HTTP GET request
int httpResponseCode = http.GET();
if (httpResponseCode>0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
String payload = http.getString();
Serial.println(payload);
}
else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
// Free resources
http.end();
}
else {
Serial.println("WiFi Disconnected");
}
lastTime = millis();
}
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
neopixels:DOUT
neopixels:VDD
neopixels:VSS
neopixels:DIN