Closed grezco closed 5 years ago
We're working on an update to this library. We can take a look at the OTA functions. It will take a couple of weeks to get to it though.
Thanks you. I will wait this update with impatience to try it.
I tried using the OTA library with ThingSpeak. It compiles fine and I can update my channel. I don't get the -301. BUT, I can't get this board to show up in the Port menu as a network option. Here is my code, maybe it will work on your setup.
char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password WiFiClient client;
unsigned long myChannelNumber = SECRET_CH_ID; const char * myWriteAPIKey = SECRET_WRITE_APIKEY;
int number = 0;
void setup() { Serial.begin(115200); // Initialize serial 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); /
Serial.print(".");
delay(5000);
}
Serial.println("\nConnected.");
// start the WiFi OTA library with internal (flash) based storage
WiFiOTA.begin("Arduino", "password", InternalStorage);
}
// check for WiFi OTA updates WiFiOTA.poll();
// 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, number, myWriteAPIKey); if(x == 200){ Serial.println("Channel update successful."); } else{ Serial.println("Problem updating channel. HTTP error code " + String(x)); }
// change the value number++; if(number > 99){ number = 0; }
delay(20000); // Wait 20 seconds to update the channel again }
Hello, From the example "WriteVoltage", if I add :
include
….
void setup() { ….. WiFiOTA.begin("Arduino", "password", InternalStorage);
}
void loop() { WiFiOTA.poll(); …... }
I have the error code -301 (Failed to connect to ThingSpeak)
Could you help me to use ThingSpeak with OTA functionality ?