tecnologia:iot:panel_baterias
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tecnologia:iot:panel_baterias [2022/04/28 21:19] – admin | tecnologia:iot:panel_baterias [2022/04/30 13:55] (current) – jose | ||
|---|---|---|---|
| Line 509: | Line 509: | ||
| </ | </ | ||
| + | ===== Muestra mensaje leido de internet con scroll ===== | ||
| + | < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | // Uncomment according to your hardware type | ||
| + | #define HARDWARE_TYPE MD_MAX72XX:: | ||
| + | //#define HARDWARE_TYPE MD_MAX72XX:: | ||
| + | |||
| + | // Defining size, and output pins | ||
| + | #define MAX_DEVICES 4 | ||
| + | #define CS_PIN 5 | ||
| + | |||
| + | const char* ssid = " | ||
| + | const char* password = " | ||
| + | |||
| + | IPAddress ip(192, | ||
| + | IPAddress gateway(192, | ||
| + | IPAddress subnet(255, | ||
| + | IPAddress dns(8, | ||
| + | |||
| + | AsyncWebServer server(80); | ||
| + | |||
| + | String mensaje=""; | ||
| + | |||
| + | String serverPath = " | ||
| + | |||
| + | |||
| + | MD_Parola Display = MD_Parola(HARDWARE_TYPE, | ||
| + | |||
| + | void setup() { | ||
| + | |||
| + | Display.begin(); | ||
| + | Display.setIntensity(0); | ||
| + | Display.displayClear(); | ||
| + | String mensaje = " | ||
| + | Display.displayScroll(mensaje.c_str(), | ||
| + | | ||
| + | Serial.begin(115200); | ||
| + | delay(10); | ||
| + | Serial.println(' | ||
| + | | ||
| + | WiFi.begin(ssid, | ||
| + | WiFi.config(ip, | ||
| + | Serial.print(" | ||
| + | Serial.print(ssid); | ||
| + | |||
| + | while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect | ||
| + | if (Display.displayAnimate()) { | ||
| + | Display.displayReset(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | Serial.println(' | ||
| + | Serial.println(" | ||
| + | Serial.print(" | ||
| + | Serial.println(WiFi.localIP()); | ||
| + | |||
| + | server.on("/", | ||
| + | request-> | ||
| + | }); | ||
| + | | ||
| + | | ||
| + | AsyncElegantOTA.begin(& | ||
| + | server.begin(); | ||
| + | Serial.println(" | ||
| + | Display.print(" | ||
| + | delay(1000); | ||
| + | |||
| + | // | ||
| + | Display.setTextAlignment(PA_CENTER); | ||
| + | Display.displayScroll(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | AsyncElegantOTA.loop(); | ||
| + | | ||
| + | if(WiFi.status()== WL_CONNECTED){ | ||
| + | |||
| + | HTTPClient http; | ||
| + | | ||
| + | // Your Domain name with URL path or IP address with path | ||
| + | http.begin(serverPath.c_str()); | ||
| + | | ||
| + | | ||
| + | // Send HTTP GET request | ||
| + | int httpResponseCode = http.GET(); | ||
| + | | ||
| + | if (httpResponseCode> | ||
| + | Serial.print(" | ||
| + | Serial.println(httpResponseCode); | ||
| + | String payload = http.getString(); | ||
| + | |||
| + | Serial.println(payload); | ||
| + | const char* mensaje=payload.c_str(); | ||
| + | Serial.println(mensaje); | ||
| + | Display.displayClear(); | ||
| + | Display.displayScroll(mensaje, | ||
| + | | ||
| + | while(!Display.displayAnimate()) | ||
| + | { | ||
| + | Serial.println(" | ||
| + | } | ||
| + | } | ||
| + | else { | ||
| + | Serial.print(" | ||
| + | Serial.println(httpResponseCode); | ||
| + | } | ||
| + | // Free resources | ||
| + | http.end(); | ||
| + | } | ||
| + | else { | ||
| + | Serial.println(" | ||
| + | } | ||
| + | } | ||
| + | </ | ||
tecnologia/iot/panel_baterias.1651180797.txt.gz · Last modified: by admin
