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

int RECV_PIN = 11;        
IRrecv irrecv(RECV_PIN);
decode_results results;
Servo myservo;


void setup()
  {
  irrecv.enableIRIn();     
  Serial.begin(9600); 
  myservo.attach(10);      
  }

void loop()
  {
  if(irrecv.decode(&results)){                
    
    if(results.value == 0x77E150F1) // om koden är uppkanppin
      {       
       myservo.write(0);
      }

     else if(results.value == 0x77E130F1) //om koden är ner
      { 
      myservo.write(180);
       }
    irrecv.resume();  // läs nästa värde                   
    }
  delay(5);
 
  }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s