My Bluetooth Remote Control Robot kit also comes with a Keyes Infrared remote sensor and a command .
You’ll need to install the IR Remote library for this to work. You can get it from github – Arduino-IR. To install, just follow the instructions provided in the README file.
If you want, you can learn a bit more about the IR protocol in the Ken Shirriff’s blog (link below).
This sensor has three PINS, from left to right : GND (-), VCC (2nd PIN), SIGNAL (S).
Let’s connect this to the Arduino. The signal PIN connect to digital PIN 11 (If you choose another, please change it in the sketch below).
#include <IRremote.h> //include the library //PIN int receiver = 11; IRrecv irrecv(receiver); //create a new instance of receiver decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); //start the receiver } void loop() { if (irrecv.decode(&results)) { //we have received an IR Serial.println (results.value, HEX); //display HEX irrecv.resume(); //next value } }
Here is the result, from pressing buttons on the remote:
References
http://tronixstuff.com/2011/03/30/tutorial-arduino-and-infra-red-control/
http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html