Seems like I have a very odd problem. I tried to compile a sketch in VS with VM and I get this error. I decided to copy it to the Arduino IDE and it compiles and upload to my esp32s board and runs perfect. Why is this?
Error compiling project sources
Debug build failed for project 'Relays_Test'
Relays_Test_esp32.ino: 6:5: error: redefinition of 'int relayPin0
int relayPin0 = 12
Relays_Test.ino:6: note int relayPin0 previously defined here
int relayPin0 = 12
Relays_Test_esp32.ino: 7:5: error: redefinition of 'int relayPin1
int relayPin1 = 27
Relays_Test.ino:7: note int relayPin1 previously defined here
int relayPin1 = 27
Relays_Test_esp32.ino: In function void setup()
Relays_Test_esp32.ino: 11:6: error: redefinition of 'void setup()
The Sketch is a relay sketch
int relayPin0 = 12;
int relayPin1 = 27;
int relayPin2 = 16;
int relayPin3 = 17;
void setup() {
pinMode(relayPin0, OUTPUT);
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
pinMode(relayPin3, OUTPUT);
digitalWrite(relayPin0, HIGH);
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
digitalWrite(relayPin3, HIGH);
}
void loop() {
digitalWrite(relayPin0, LOW);
delay(2000);
digitalWrite(relayPin0, HIGH);
delay(4000);
digitalWrite(relayPin1, LOW);
delay(2000);
digitalWrite(relayPin1, HIGH);
delay(4000);
digitalWrite(relayPin2, LOW);
delay(2000);
digitalWrite(relayPin2, HIGH);
delay(4000);
digitalWrite(relayPin3, LOW);
delay(2000);
digitalWrite(relayPin3, HIGH);
delay(4000);
}