360 degree servo code trouble

Not going to lie, I’m not very good with code at all and apparently neither is my teacher because I cannot get any help on this project. I am trying to create a code that has an IRremote control a 360 degree servo motor for a project. I believe it has something to do with the decode results, but i have no idea what to do or what to change. Please help. Thank you.


Code:

#include <IRremote.h>
#include <Servo.h>

#define MY_PROTOCOL NEC
#define RIGHT_ARROW 0xfd50af //Move several clockwise
#define LEFT_ARROW 0xfd10ef //Move servo counterclockwise
#define SELECT_BUTTON 0xfd906f //Center the servo
#define UP_ARROW 0xfda05f
#define DOWN_ARROW 0xfdb04f
#define BUTTON_0 0xfd30cf //Pushing buttons 0-9 moves to fixed positions
#define BUTTON_1 0xfd08f7
#define BUTTON_2 0xfd8877
#define BUTTON_3 0xfd48b7
#define BUTTON_4 0xfd28d7
#define BUTTON_5 0xfda857
#define BUTTON_6 0xfd6897
#define BUTTON_7 0xfd18e7
#define BUTTON_8 0xfd9867
#define BUTTON_9 0xfd58a7

IRrecv My_Receiver(11);//Receive on pin 11
decode_results results; //define variable results to save the result of infrared
Servo My_Servo; // create servo object to control a servo
int pos; // variable to store the servo position
int Speed; // Number of degrees to move each time a left/right button is pressed
long Previous; // Stores previous code to handle NEC repeat codes

void setup() {
My_Servo.attach(9); // attaches the servo on pin 9 to the servo object
pos = 90; // start at midpoint 90 degrees
Speed = 3; // servo moves 3 degrees each time left/right is pushed
My_Servo.write(pos); // Set initial position
My_Receiver.enableIRIn(); // Start the receiver
}

void loop() {
if (IRrecv.decode(&results)) { {
decode_results.decode();
if(decode_results.decode_type==MY_PROTOCOL) {
if(decode_results.value==0xFFFFFFFF)
decode_results.value=Previous;
switch(decode_results.value) {
case LEFT_ARROW: pos=min(180,pos+Speed); break;
case RIGHT_ARROW: pos=max(0,pos-Speed); break;
case SELECT_BUTTON: pos=90; break;
case UP_ARROW: Speed=min(10, Speed+1); break;
case DOWN_ARROW: Speed=max(1, Speed-1); break;
case BUTTON_0: pos=090; break;
case BUTTON_1: pos=1
00; break;
case BUTTON_2: pos=290; break;
case BUTTON_3: pos=3
90; break;
case BUTTON_4: pos=490; break;
case BUTTON_5: pos=5
90; break;
case BUTTON_6: pos=690; break;
case BUTTON_7: pos=7
90; break;
case BUTTON_8: pos=890; break;
case BUTTON_9: pos=9
0; break;
}
My_Servo.write(pos); // tell servo to go to position in variable ‘pos’
Previous=decode_results.value;

}
My_Receiver.resume();
}
}
}


Errors:

In function ‘void loop()’:

40: error: expected primary-expression before ‘.’ token

if (IRrecv.decode(&results)) { {

^

41: error: expected unqualified-id before ‘.’ token

decode_results.decode();

^

42: error: expected primary-expression before ‘.’ token

if(decode_results.decode_type==MY_PROTOCOL) {

^

43: error: expected primary-expression before ‘.’ token

if(decode_results.value==0xFFFFFFFF)

^

44: error: expected unqualified-id before ‘.’ token

decode_results.value=Previous;

^

45: error: expected primary-expression before ‘.’ token

switch(decode_results.value) {

^

63: error: expected primary-expression before ‘.’ token

Previous=decode_results.value;

^

exit status 1
expected primary-expression before ‘.’ token

You have not created an object called IRrecv. You can only call methods on instances that you have created. You DID create an instance of the appropriate class, called My_Receiver. Use that instance name.

You created an instance of the decode_results struct, but you did not call it decode_results. Use the name of the instance you created.

Look at the IRrecvDemo example.