By mayaku - Fri Jan 31, 2020 7:56 pm
- Fri Jan 31, 2020 7:56 pm
#19492
(F*** Google Drive... I will upload the pic somewhere else...)
I just had the same problem but here is the solution:Buddasticks wrote: ↑Wed Jan 29, 2020 11:36 pmi get an error while compilingmayaku wrote: ↑Wed Jan 29, 2020 10:10 amThe OTA Update is finally working!!!
Code: Select allThe ESP32 is connecting to a SSID when turning the OTA switch on. If the specified SSID is not present the ESP32 will reboot. If connected you can upload your sketch through the Arduino IDE over the new port// RemoteXY select connection mode and include library #define REMOTEXY_MODE__ESP32CORE_BLE #include <RemoteXY.h> // RemoteXY connection settings #define REMOTEXY_BLUETOOTH_NAME "Your Scooter" #define REMOTEXY_ACCESS_PASSWORD "password" // RemoteXY configurate #pragma pack(push, 1) uint8_t RemoteXY_CONF[] = { 255,4,0,0,0,155,0,8,8,1, 2,0,6,16,22,11,4,26,31,31, 79,78,0,79,70,70,0,129,0,8, 8,18,6,16,80,111,119,101,114,0, 2,0,36,18,18,8,1,26,31,31, 79,78,0,79,70,70,0,129,0,39, 10,12,6,16,70,97,115,116,0,3, 3,13,48,9,25,3,26,129,0,14, 38,15,6,16,76,105,103,104,116,0, 129,0,27,49,8,6,16,79,110,0, 129,0,27,58,9,6,16,79,102,102, 0,129,0,27,66,24,6,16,66,108, 105,110,107,105,110,103,0,2,0,7, 89,14,7,14,26,31,31,79,78,0, 79,70,70,0,129,0,24,90,28,5, 16,79,84,65,32,85,112,100,97,116, 101,0 }; // this structure defines all the variables of your control interface struct { // input variable uint8_t switch_1; // =1 if switch ON and =0 if OFF uint8_t speed_switch; // =1 if switch ON and =0 if OFF uint8_t select_1; // =0 if select position A, =1 if position B, =2 if position C, ... uint8_t ota_update; // =1 if switch ON and =0 if OFF // other variable uint8_t connect_flag; // =1 if wire connected, else =0 } RemoteXY; #pragma pack(pop) /** httpUpdate.ino Created on: 27.11.2015 */ #include <Arduino.h> #include <WiFi.h> #include <WiFiMulti.h> #include <ArduinoOTA.h> #include <HTTPClient.h> #include <HTTPUpdate.h> const char* ssid = "SSID"; const char* password = "PASSWORD"; byte slow[] = {0xA6, 0x12, 0x02, 0x35, 0x14, 0xF1}; // Speed Limit to 20 km/h byte fast[] = {0xA6, 0x12, 0x02, 0x35, 0xFF, 0x38}; // Maximum Speed byte off[] = {0xA6, 0x12, 0x02, 0x00, 0xFF, 0xEA}; byte fast_stealth[] = {0xA6, 0x12, 0x02, 0x31, 0xFF, 0x03}; byte fast_blinking[] = {0xA6, 0x12, 0x02, 0x33, 0xFF, 0x92}; byte slow_stealth[] = {0xA6, 0x12, 0x02, 0x31, 0x14, 0xCA}; byte slow_blinking[] = {0xA6, 0x12, 0x02, 0x33, 0x14, 0x5B}; int run_once = 0; void setup() { Serial.begin(9600); RemoteXY_Init (); } void loop() { ArduinoOTA.handle(); if((RemoteXY.ota_update == 1) && (run_once == 0)) { Serial.println("Booting"); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.waitForConnectResult() != WL_CONNECTED) { Serial.println("Connection Failed! Rebooting..."); delay(5000); ESP.restart(); } // Port defaults to 8266 // ArduinoOTA.setPort(8266); // Hostname defaults to esp8266-[ChipID] ArduinoOTA.setHostname("Your Scooter"); // No authentication by default ArduinoOTA.setPassword((const char *)"password"); ArduinoOTA.onStart([]() { Serial.println("Start"); }); ArduinoOTA.onEnd([]() { Serial.println("\nEnd"); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { Serial.printf("Progress: %u%%\r", (progress / (total / 100))); }); ArduinoOTA.onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed"); else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed"); else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed"); else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed"); else if (error == OTA_END_ERROR) Serial.println("End Failed"); }); ArduinoOTA.begin(); Serial.println("Ready"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); run_once = 1; } if((RemoteXY.ota_update == 0) && (run_once == 0)) { RemoteXY_Handler (); if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 0) && (RemoteXY.select_1 == 0)) { Serial.write(slow, sizeof(slow)); } else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 0) && (RemoteXY.select_1 == 1)) { Serial.write(slow_stealth, sizeof(slow_stealth)); } else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 0) && (RemoteXY.select_1 == 2)) { Serial.write(slow_blinking, sizeof(slow_blinking)); } else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 1) && (RemoteXY.select_1 == 0)) { Serial.write(fast, sizeof(fast)); } else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 1) && (RemoteXY.select_1 == 1)) { Serial.write(fast_stealth, sizeof(fast_stealth)); } else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 1) && (RemoteXY.select_1 == 2)) { Serial.write(fast_blinking, sizeof(fast_blinking)); } else { Serial.write(off, sizeof(off)); } delay(200); } }
Sketch uses 1388490 bytes (105%) of program storage space. Maximum is 1310720 bytes.
Global variables use 62020 bytes (18%) of dynamic memory, leaving 265660 bytes for local variables. Maximum is 327680 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board DOIT ESP32 DEVKIT V1
(F*** Google Drive... I will upload the pic somewhere else...)
Last edited by mayaku on Sun Feb 02, 2020 12:58 pm, edited 2 times in total.