program of remote control

Discussion in 'Embedded Systems and Microcontrollers' started by bhuvanesh, Jan 17, 2014.

  1. bhuvanesh

    Thread Starter Member

    Aug 10, 2013
    268
    2
    Code ( (Unknown Language)):
    1.  
    2. void setup()
    3. {
    4.   pinMode(15,INPUT);
    5.   Serial.begin(9600);
    6. }
    7.  
    8. void loop()
    9. {
    10.   int v=0;
    11.  
    12.   int a=pulseIn(15,LOW);
    13.   if(a>2000)
    14.   {
    15.     for(int i=0;i<12;i++)  
    16.     {
    17.       if(pulseIn(15,LOW)>1000)//doubt is here
    18.       {
    19.         v=v+(1<<i);
    20.  
    21.        
    22.       }
    23.     }
    24.     Serial.println(v);
    25.     delay(500);
    26.   }
    27. }
    28.  
    29.  
    30.  
    code of arduino.
    This is code for receiving remote signal and converting it to decimal.my protocol is of about 13 bit information. see that (pulseIn(15,LOW)>1000 line.here it receiving 12 bit of data by skipping first start bit.why it is so.
     
Loading...