so this is my code and I'm very new to Arduino so could someone please help me with this error. I keep getting it no matter what I change.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(12, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int ldr = 1023 - analogRead(A0);
Serial.println(ldr);
delay(500);
if(ldr > 1022);
digitalWrite(12, LOW);
if else(ldr < 1022);
digitalWrite(12, HIGH);
}
I don't see the error right away. But for better help, have a look at the stickey How to get the most out of this forum. For example about posting code. And the fact your error does in fact contain more info then you showed.
Please post your code within </> code-tags
and use ctrl-T (auto-format) before.
if else(ldr < 1022);
This is where the code lights up, so here is where to have a closer look, it should be 'else if' mind you once that is changed and you compile i am pretty sure your code won't work as expected, due to the semicolons at the end of the if statements.
if(ldr > 1022); // this ';' shouldn't be there
digitalWrite(12, LOW);