I have been trying to upload code using arduino 1.8.19 but it takes forever whenever i want to change one small thing. Can anyone help?
Welcome to the forum
How long is "forever" ?
Is there a reason why you are not using version 2 of the IDE ?
forever~15 min
i am not using the newer version because it never loads
It sounds like something is fundamentally wrong
Which Operating System are you using and have you ever been able to upload a sketch to a board ?
i am using windows 10 and i have uploaded a sketch before but i neede to change it anfd now i can’t
Are you using the same board and USB cable that worked before ? Exactly which board are you using and which board have you got selected in the IDE ? Is it the compilation or upload phase that takes "forever" ?
Are trying to upload or to compile.
Compiling for the ESP32 can take some time (minutes), depending on computer power.
Second compile time after a little change should be faster.
Upload however should only take less than 30 seconds.
Tell us exactly which ESP32 board you have and what you select in the IDE.
Posting the offending code could also help.
Did you install the correct ESP32 library.
Leo..
I am using exactly the same hardware. It is board: ESP32 Dev Module and i have got that selected. The compilation phase is what takes the time
I have used the esp32 package by Espressif Systems.
This is the code:
#include <WiFi.h>
#include <WebServer.h>
#include <ArduinoOTA.h>
#include <BluetoothSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <MFRC522.h>
#include <ESP32Servo.h>
#include <DHT.h>
#include <Adafruit_NeoPixel.h>
// ---------- WIFI ----------
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
// ---------- PINS ----------
#define DHT_PIN 17
#define DHT_TYPE DHT11
#define YELLOW_LED 12
#define STEAM_SENSOR 34
#define FAN_IN_MINUS 18
#define FAN_IN_PLUS 19
#define PIR_PIN 14
#define LEFT_BUTTON 16
#define RIGHT_BUTTON 27
#define GAS_SENSOR 23
#define BUZZER_PIN 25
#define WS2812_PIN 26
#define WINDOW_SERVO 5
#define DOOR_SERVO 13
#define SDA_PIN 21
#define SCL_PIN 22
// ---------- OBJECTS ----------
BluetoothSerial SerialBT;
WebServer server(80);
LiquidCrystal_I2C lcd(0x27, 16, 2);
MFRC522 rfid(0x28); // I2C RFID
DHT dht(DHT_PIN, DHT_TYPE);
Servo windowServo;
Servo doorServo;
Adafruit_NeoPixel rgb(1, WS2812_PIN, NEO_GRB + NEO_KHZ800);
// ---------- STATES ----------
bool fanState = false;
bool doorOpen = false;
bool windowOpen = false;
// ---------- RFID UID (CHANGE THIS) ----------
byte allowedUID[4] = {0xDE, 0xAD, 0xBE, 0xEF};
// ---------- FUNCTIONS ----------
void updateLCD(float t, float h) {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("T:");
lcd.print(t);
lcd.print("C H:");
lcd.print(h);
lcd.setCursor(0,1);
lcd.print(doorOpen ? "Door:Open " : "Door:Closed");
}
void beep(int ms=100) {
digitalWrite(BUZZER_PIN, HIGH);
delay(ms);
digitalWrite(BUZZER_PIN, LOW);
}
void toggleDoor() {
doorOpen = !doorOpen;
doorServo.write(doorOpen ? 90 : 0);
}
void toggleWindow() {
windowOpen = !windowOpen;
windowServo.write(windowOpen ? 90 : 0);
}
void fanOn() {
digitalWrite(FAN_IN_PLUS, HIGH);
digitalWrite(FAN_IN_MINUS, LOW);
fanState = true;
}
void fanOff() {
digitalWrite(FAN_IN_PLUS, LOW);
digitalWrite(FAN_IN_MINUS, LOW);
fanState = false;
}
// ---------- WEB ----------
void handleRoot() {
server.send(200, "text/html",
"<h1>KS5009 Smart Home</h1>"
"<a href='/fan/on'>Fan ON</a><br>"
"<a href='/fan/off'>Fan OFF</a><br>"
"<a href='/door'>Toggle Door</a><br>"
"<a href='/window'>Toggle Window</a><br>"
"<a href='/beep'>Beep</a>"
);
}
void setup() {
Serial.begin(115200);
pinMode(YELLOW_LED, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(PIR_PIN, INPUT);
pinMode(LEFT_BUTTON, INPUT_PULLUP);
pinMode(RIGHT_BUTTON, INPUT_PULLUP);
pinMode(FAN_IN_PLUS, OUTPUT);
pinMode(FAN_IN_MINUS, OUTPUT);
Wire.begin(SDA_PIN, SCL_PIN);
lcd.init();
lcd.backlight();
dht.begin();
rfid.PCD_Init();
rgb.begin();
rgb.setPixelColor(0, rgb.Color(0, 0, 255));
rgb.show();
windowServo.attach(WINDOW_SERVO);
doorServo.attach(DOOR_SERVO);
SerialBT.begin("KS5009_SmartHome");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) delay(500);
ArduinoOTA.setHostname("KS5009_OTA");
ArduinoOTA.begin();
server.on("/", handleRoot);
server.on("/fan/on", [](){ fanOn(); server.send(200,"text/plain","Fan ON");});
server.on("/fan/off", [](){ fanOff(); server.send(200,"text/plain","Fan OFF");});
server.on("/door", [](){ toggleDoor(); server.send(200,"text/plain","Door");});
server.on("/window", [](){ toggleWindow(); server.send(200,"text/plain","Window");});
server.on("/beep", [](){ beep(); server.send(200,"text/plain","Beep");});
server.begin();
}
void loop() {
server.handleClient();
ArduinoOTA.handle();
// Buttons
if (!digitalRead(LEFT_BUTTON)) { toggleDoor(); delay(300); }
if (!digitalRead(RIGHT_BUTTON)) { toggleWindow(); delay(300); }
// PIR
if (digitalRead(PIR_PIN)) {
digitalWrite(YELLOW_LED, HIGH);
} else {
digitalWrite(YELLOW_LED, LOW);
}
// RFID
if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
bool ok = true;
for (byte i=0;i<4;i++)
if (rfid.uid.uidByte[i] != allowedUID[i]) ok=false;
if (ok) { toggleDoor(); beep(200); }
rfid.PICC_HaltA();
}
// Sensors
float t = dht.readTemperature();
float h = dht.readHumidity();
if (!isnan(t) && !isnan(h)) updateLCD(t, h);
delay(200);
}
Which Partition Scheme have you got selected in the IDE ?
I did have the default but then I changed to a more advanced one and it compiled and uploaded successfully. Thank You for your help.
![]()
I am glad I was able to help
Good luck with your project
You really should try IDE 2.x again. I see that you have not reported the problem in a forum post