this has been solved thanks to the lovely folks in the comments btw
for you guys who struggle and is too lazy to read heres the summary
DONT SAVE BACKUPS INSIDE THE SAME FOLDER
thats it
here is the original post
|
V
ive been having problems with my code
im super new to arduino ( 3 days experience) and i made a code that is supposed to allow for adjustable rgb led ( so that i can adjust the R the G and the B by using values from 3 seperate variable resistors. is that confusing? it probably is.) here is my code
int R=11;
int G=10;
int B=9;
int a=0;
int b=0;
int c=0;
int d=0;
int e=0;
int f=0;
void setup() {
Serial.begin(9600);
pinMode(R,OUTPUT);
pinMode(G,OUTPUT);
pinMode(B,OUTPUT);
// put your setup code here, to run once:
}
void loop() {
a=analogRead(A0);
b=analogRead(A1);
c=analogRead(A2);
Serial.println(a);
d=map(a,0,1023,0,255);
e=map(b,0,1023,0,255);
f=map(c,0,1023,0,255);
analogWrite(R,d );
analogWrite(G,e );
analogWrite(B,f );
}
its garbage i know.
i made this code like maybe 8 hours before this post( in the morning ) and now that ive started working on it again i wanted to try adding some stuff to it ( if else functions where if the value of d e or f is more than 200 it would blink with a delay of .05 seconds ) and now it gets this error message btw just ignore my poor file name choice
Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:1:5: error: redefinition of 'int R'
int R=11;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:1:5: note: 'int R' previously defined here
int R=11;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:2:5: error: redefinition of 'int G'
int G=10;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:2:5: note: 'int G' previously defined here
int G=10;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:3:5: error: redefinition of 'int B'
int B=9;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:3:5: note: 'int B' previously defined here
int B=9;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:4:5: error: redefinition of 'int a'
int a=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:4:5: note: 'int a' previously defined here
int a=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:5:5: error: redefinition of 'int b'
int b=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:5:5: note: 'int b' previously defined here
int b=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:6:5: error: redefinition of 'int c'
int c=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:6:5: note: 'int c' previously defined here
int c=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:7:5: error: redefinition of 'int d'
int d=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:7:5: note: 'int d' previously defined here
int d=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:8:5: error: redefinition of 'int e'
int e=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:8:5: note: 'int e' previously defined here
int e=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:9:5: error: redefinition of 'int f'
int f=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:9:5: note: 'int f' previously defined here
int f=0;
^
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino: In function 'void setup()':
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:10:6: error: redefinition of 'void setup()'
void setup() {
^~~~~
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:10:6: note: 'void setup()' previously defined here
void setup() {
^~~~~
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino: In function 'void loop()':
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\adjustable RGB light ( it works )(needs 3 turny things).ino:19:6: error: redefinition of 'void loop()'
void loop() {
^~~~
C:\Users\hp\Desktop\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_\arduino_adjustable_RGB_led_that_uses_3_variable_resistors_that_.ino:19:6: note: 'void loop()' previously defined here
void loop() {
^~~~
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
i then tried to revert the code back to its original state which i am sure it is the original one because i took a picture of it and it still gets the same error message
im pretty sure its just going to boil down to me being a retard and forgetting a ; or a , but i still need your help.
thankyou in advance.