I'm sure it's a simple syntax error but I'm too inexperienced to find it any help is greatly appreciated here is my code:
#include <IRremote.h> //must copy IRremote library to arduino libraries
#include <Servo.h>
#define plus 0xFFA25D //clockwise rotation button, set to power button
#define minus 0xFFE21D //counter clockwise rotation button, set to func/stop button
#define code1 0xFFA25D //code received from first led button
#define code2 0xFFE21D //code received from second led button
int RECV_PIN = 11; //IR receiver pin
int led1 = 2; //grn
int led2 = 4; //red
int itsONled[] = {0,0,0,0}; //turns off lights at start
Servo servo;
int val; //rotation angle
bool cwRotation, ccwRotation; //the states of rotation
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
servo.attach(9); //servo pin
pinMode(led1, OUTPUT); //sets the pin defined as led1 as an output
pinMode(led2, OUTPUT); // sets the pin defined as led2 as an output
}
void loop()
{
if (irrecv.decode(&results))
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
if (results.value == plus){
{
cwRotation = !cwRotation; //toggle the rotation value
ccwRotation = false; //no rotation in this direction
}
if (results.value == minus)
{
ccwRotation = !ccwRotation; //toggle the rotation value
cwRotation = false; //no rotation in this direction
}
}
if (cwRotation && (val != 175)) {
val++; //for colockwise button
}
if (ccwRotation && (val != 0)) {
val--; //for counter colockwise button
}
servo.write(val);
delay(20); //General speed
}
break; ERROR OCCURS ON THIS LINE
case code1
if (irrecv.decode(&results)) {
unsigned int value = results.value;
switch(value) {
case code1:
if(itsONled[1] == 1) { // if first led is on then
digitalWrite(led1, LOW); // turn it off when button is pressed
itsONled[1] = 0; // and set its state as off
} else { // else if first led is off
digitalWrite(led1, HIGH);
// turn it on when the button is pressed
itsONled[1] = 1; // and set its state as on
}
break;
case code2:
if(itsONled[2] == 1) {
digitalWrite(led2, LOW);
itsONled[2] = 0;
} else {
digitalWrite(led2, HIGH);
itsONled[2] = 1;
}
}