informatica:arduino:esp32
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
informatica:arduino:esp32 [2021/02/07 22:03] – jose | informatica:arduino:esp32 [2022/10/24 22:12] (current) – jose | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ESP32 | + | ====== Ejemplos: ====== |
+ | **Estación Metereológica: | ||
+ | https:// | ||
+ | ====== Bateria bien montada ====== | ||
+ | https:// | ||
+ | |||
+ | ====== ESP32 ====== | ||
{{: | {{: | ||
Line 14: | Line 20: | ||
Ponemos esta URL en file > preferences > Additional Boards Manager URLs: | Ponemos esta URL en file > preferences > Additional Boards Manager URLs: | ||
https:// | https:// | ||
+ | |||
+ | Tarda un ratillo en descargárselas | ||
Ahora vamos a tools > Board: “Arduino Uno” y seleccionamos Boards Manager. Buscamos esp32 y damos a install | Ahora vamos a tools > Board: “Arduino Uno” y seleccionamos Boards Manager. Buscamos esp32 y damos a install | ||
Line 29: | Line 37: | ||
const char* ssid = " | const char* ssid = " | ||
- | const char* password = "reyvisigodo"; | + | const char* password = "********"; |
void setup() { | void setup() { | ||
Line 65: | Line 73: | ||
</ | </ | ||
+ | HAcer petición GET y POST | ||
+ | < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | const char* ssid = " | ||
+ | const char* password = " | ||
+ | |||
+ | //Your Domain name with URL path or IP address with path | ||
+ | String serverName = " | ||
+ | |||
+ | // the following variables are unsigned longs because the time, measured in | ||
+ | // milliseconds, | ||
+ | unsigned long lastTime = 0; | ||
+ | // Timer set to 10 minutes (600000) | ||
+ | //unsigned long timerDelay = 600000; | ||
+ | // Set timer to 5 seconds (5000) | ||
+ | unsigned long timerDelay = 5000; | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | |||
+ | WiFi.begin(ssid, | ||
+ | Serial.println(" | ||
+ | while(WiFi.status() != WL_CONNECTED) { | ||
+ | delay(500); | ||
+ | Serial.print(" | ||
+ | } | ||
+ | Serial.println("" | ||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.localIP()); | ||
+ | |||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | //Send an HTTP POST request every 10 minutes | ||
+ | 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()); | ||
+ | | ||
+ | // Send HTTP GET request | ||
+ | int httpResponseCode = http.GET(); | ||
+ | | ||
+ | if (httpResponseCode> | ||
+ | Serial.print(" | ||
+ | Serial.println(httpResponseCode); | ||
+ | String payload = http.getString(); | ||
+ | Serial.println(payload); | ||
+ | } | ||
+ | else { | ||
+ | Serial.print(" | ||
+ | Serial.println(httpResponseCode); | ||
+ | } | ||
+ | // Free resources | ||
+ | http.end(); | ||
+ | } | ||
+ | else { | ||
+ | Serial.println(" | ||
+ | } | ||
+ | lastTime = millis(); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
====== Python ====== | ====== Python ====== | ||
Line 135: | Line 213: | ||
En Tools > Board: " | En Tools > Board: " | ||
+ | |||
+ | |||
+ | ====== Energia y consumo ====== | ||
+ | https:// | ||
+ | |||
+ | ====== Pantalla e-paper ====== | ||
+ | https:// |
informatica/arduino/esp32.1612735393.txt.gz · Last modified: 2021/02/07 22:03 by jose