I am planning on using arduino as controller, which worked fine. However i noticed the script to turn on a led with a button disconnects (temporarily) the arduino, and I thought that an turn off switch would be very usefull. So I used a few different codes to make this thing, which gives the error in title:
sketch_dec26a.ino (1.99 KB)
Where does the loop() function end ?
You have code not in a function. Hence the error
Thanks, i didn't notice the bracket, because the error for it was the 2nd - 4th error after more of the errors like in the title. Also, i reccommend checking out the guy who made the joystick code (The links at the start of the code) as his was one of the smallest codes that were good, and i just replaced 4 numbers to make it better for me.
But really, i just made a frankenstein out of 3 codes, two of which were from tutorials on arduino side.
It is your problem. Your loop function ends here:
time = millis();
The if/else code looks suspicious to me too
if (ooreading == HIGH && ooprevious == LOW && millis() - time > debounce)
if (oostate == HIGH)
oostate = LOW;
digitalWrite(LED_PIN, HIGH); //should this line depend on the if ?
oostate = HIGH;
digitalWrite(LED_PIN, LOW); //should this line depend on the else ?
Please follow the advice on posting a programming question given in Read this before posting a programming question
In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless