Arduino Forum

Topics => Robotics => Topic started by: Dexster on Jun 08, 2018, 12:49 am

Title: 3 Servo, 3 buttons
Post by: Dexster on Jun 08, 2018, 12:49 am
Please help. I seem to be having a issue with my code or the board, i'm not sure. I keep getting this message;
"Error compiling for board Arduino/Genuino Uno.
exit status 1
Error compiling for Arduino.Genuio Uno."

This is the code i'm using.
Code: [Select]

#include <Servo.h>
#include <Button.h>
Servo RE;
int REpos = 0;
const int buttonREPin = 2;
int buttonREState = 0;

void setup() {
  // put your setup code here, to run once:
RE.attach(9); //right eye from robotos veiw
pinMode(RE,OUTPUT);
pinMode(buttonRE,OUTPUT);

void loop() {
  // put your main code here, to run repeatedly:
{for (REpos = 0; REpos <= 360; REpos +=1)
RE.write(REpos);
delay(59.9);

for (REpos =360; REpos >= 0; REpos -=1)
RE.write(REpos);
delay(59.9);}
buttonREState = digitalRead(buttonPin);
(buttonMOState == HIGH){
  digitalWrite(MO, HIGH);
} else {
  digitalWrite(MO, LOW);
}
}


I'm not sure why it would be doing this, could it be my code? any help on this would be much appreciated. (I understand that HIGH and LOW are for LED's, i don't know what to use to say off)
Title: Re: 3 Servo, 3 buttons
Post by: TolpuddleSartre on Jun 08, 2018, 08:53 am
Look at your setup function.

Where does it end?

(It is helpful if you post error messages)

Code: [Select]
delay(59.9);
No, you need to look harder at the documentation.

Code: [Select]
(buttonMOState == HIGH){ Missing an "if", I guess.

It also looks like you've got a bunch of mismatched {} braces
Title: Re: 3 Servo, 3 buttons
Post by: vinceherman on Jun 08, 2018, 04:04 pm
To the point of mismatched curly braces, format your code.

CTRL-T in the development application auto formats the code, making problems with mismatched braces readily apparent.