#include <IRremote.h>
#include <Servo.h>
Servo servo;
int pinIR = 11;
IRrecv recv(pinIR);
decode_results hasil;
int sudut = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
recv.enableIRIn();
servo.attach(5);
}
void loop() {
// put your main code here, to run repeatedly:
if(recv,(&hasil)){
Serial.println(hasil.value);
recv.resume();
if(hasil.value==2);{
sudut++;
if (sudut >=180){
sudut=180;
}
servo.write(sudut);
}
if(hasil.value==152);{
sudut--;
if (sudut <=0){
sudut=0;
servo.write(sudut);
}
}
}
Serial.println(sudut);
}