69-2WD araba IR (infrared)(kızılötesi) kumanda kontrol

2WD araba IR (infrared)(kızılötesi) kumanda kontrol

IR kumanda kütüohanesi için tıklayınız.

					

#include <IRremote.h>

int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;

#define CH1 0xFFA25D
#define CH 0xFF629D
#define CH2 0xFFE21D
#define PREV 0xFF22DD
#define NEXT 0xFF02FD
#define PLAYPAUSE 0xFFC23D
#define VOL1 0xFFE01F
#define VOL2 0xFFA857
#define EQ 0xFF906F
#define BUTON0 0xFF6897
#define BUTON100 0xFF9867
#define BUTON200 0xFFB04F
#define BUTON1 0xFF30CF
#define BUTON2 0xFF18E7
#define BUTON3 0xFF7A85
#define BUTON4 0xFF10EF
#define BUTON5 0xFF38C7
#define BUTON6 0xFF5AA5
#define BUTON7 0xFF42BD
#define BUTON8 0xFF4AB5
#define BUTON9 0xFF52AD

void setup() {
irrecv.enableIRIn();   
}

void dur()
    {
        analogWrite(5,0);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,0);
    }
void ileri()
    {
        analogWrite(5,255);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,255);
    }
void geri()
    {
        analogWrite(5,0);
        analogWrite(6,255);
        analogWrite(9,255);
        analogWrite(10,0);
    }
void sag()
    {
        analogWrite(5,0);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,255);
    }
void sol()
    {
        analogWrite(5,255);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,0);
    }
void loop() {

  if (irrecv.decode(&results))
    {
    if (results.value == BUTON2)
    {
      ileri();
    }
    if (results.value == BUTON8)
    {
      geri();
    }
    if (results.value == BUTON6)
    {
      sag();
    }
    if (results.value == BUTON4)
    {
      sol();
    }
    if (results.value == BUTON5)
    {
      dur();
    }
    
    irrecv.resume();  
  }
}