Commit 92c94d38 authored by Daniel Stan's avatar Daniel Stan

lotus !

parent 3f311d97
/* Arduino directement connecté à kugel, pour communiquer
avec programme python coté port série*/
// Pin du recepteur Infrarouge
#define RECV_PIN 13
// Pin du moteur
#define RF_M_CONT 10
#define RF_M_DRV1 11
#define RF_M_DRV2 12
#include <IRLib.h>
IRrecv My_Receiver(RECV_PIN);
// For ir-decoder
IRdecodeNEC My_Decoder;
unsigned int Buffer[RAWBUF];
void setup()
{
Serial.begin(9600);
delay(2000);
while(!Serial);//delay for Leonardo
My_Receiver.enableIRIn(); // Start the receiver
My_Decoder.UseExtnBuf(Buffer);
pinMode(RF_M_CONT, OUTPUT);
pinMode(RF_M_DRV1, OUTPUT);
pinMode(RF_M_DRV2, OUTPUT);
digitalWrite(RF_M_CONT, HIGH);
digitalWrite(RF_M_DRV1, LOW);
digitalWrite(RF_M_DRV2, HIGH);
}
void loop() {
int val;
int incomingByte = 0;
delay(1000);
digitalWrite(RF_M_DRV1, LOW);
digitalWrite(RF_M_DRV2, HIGH);
delay(1000);
digitalWrite(RF_M_DRV2, LOW);
digitalWrite(RF_M_DRV1, HIGH);
if (My_Receiver.GetResults(&My_Decoder)) {
//Restart the receiver so it can be capturing another code
//while we are working on decoding this one.
My_Receiver.resume();
if ( My_Decoder.decode() )
switch (My_Decoder.value) {
case 0xFD807F:
Serial.println("Control: PPause");
break;
case 0xFD00FF:
Serial.println("Control: Vol-");
break;
case 0xFD40BF:
Serial.println("Control: Vol+");
break;
case 0xFD08F7:
Serial.println("Control: 1");
break;
case 0xFD8877:
Serial.println("Control: 2");
break;
case 0xFD48B7:
Serial.println("Control: 3");
break;
case 0xFD28D7:
Serial.println("Control: 4");
break;
case 0xfd10ef:
Serial.println("Control: Prev");
break;
case 0xfd50af:
Serial.println("Control: Next");
break;
case 0xfd20df:
Serial.println("Control: Setup");
break;
case 0xfd609f:
Serial.println("Control: Stop");
break;
case 0xfd906f:
Serial.println("Control: Enter");
break;
case 0xfd708f:
Serial.println("Control: Return");
break;
default:
Serial.print("Unkwon: ");
Serial.println(My_Decoder.value);
}
//My_Decoder.DumpResults();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment