Hola yo hace un tiempo compre un modulo wemos mini wifi (ESP8266 mini) y estoy haciendo un proyecto donde voy a mandar los datos de temperatura de un sensor a thingSpeak. El código que uso para enviar los datos es el siguiente:
#include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros
#include <ESP8266WiFi.h>
char ssid[] = "wemos_Arley" ; // your network SSID (name)
char pass[] = "al120407"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
WiFiClient client;
unsigned long myChannelNumber = 2801783;
const char * myWriteAPIKey = "4TK0209K3DCO0MR7";
int number = 0;
void setup() {
Serial.begin(115200); // Initialize serial
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo native USB port only
}
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client); // Initialize ThingSpeak
}
void loop() {
// Connect or reconnect to WiFi
if(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect to SSID: ");
Serial.println(SECRET_SSID);
while(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
Serial.print(".");
delay(5000);
}
Serial.println("\nConnected.");
}
// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
// pieces of information in a channel. Here, we write to field 1.
int x = ThingSpeak.writeField(myChannelNumber, 1, TEMPERATURA, myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
const int SENSOR=A0;
int VALOR;
float TEMPERATURA;
VALOR=analogRead(SENSOR);
TEMPERATURA=(-165.0/1023.0)*VALOR+(125.0);
delay(20000); // Wait 20 seconds to update the channel again
}
Y vi que necesitaba obligatoriamente la librería ESP8266WiFI.h la cual es la que hace que el módulo se conecte a la red wifi. Así que me dispuse a buscarla e instalarla.
En el proceso me encontré un enlace de GitHub: Arduino/libraries/ESP8266WiFi at master · esp8266/Arduino · GitHub, en el cual hay donde hay bastantes librerías relacionadas al módulo (ESP8266 mini) y en ese montón encontré la que quería (o eso pensé). la descargue y la puse en la sección de librerías de Arduino ide. pero cuando le di verificar me salían notificaciones las cuales me decían que me faltaban archivos. Y lo peor es que pase un buen rato buscando los archivos que Arduino ide me notificaba en la web. Me dejo horrendamente frustrado.
Después me puse a investigar en google como instalar librerías para saber cómo descargarla correctamente y vi que toca descargarlas en su formato ZIP y que en GitHub tocaba hacer click en el botón que dice en el cual hay una opción que decía "download ZIP" para descargarlas. Descargue el archivo y en arduino ide fui a agregarla con la opción "Añadir biblioteca. zip "; sin embargo, me comensaba a salir este error: "Error: 13 INTERNAL: La instalación de la librería no fue exitosa: moving extracted archive to destination dir: library not valid".
No sé qué es lo que estoy haciendo mal, pero si alguien sabe del porque sale este error y si alguien sabe una forma alternativa de descargarla sin que le falten archivos y ningún virus se lo agradecería muchísimo.
