New member signing in! Hopefully this is the correct section to post and this hadn't bee discussed too many times earlier.
I have an Arduino Duo. My project is to make a small stand-alone ir-remote converter. I have a Bang & Olufsen audio system. I would like the converter to listen to the IR data, note when there is a command sent, capture a pre-set length of bytes and compare this to preset strings (=to identify certain commands). Then the program should react in a certain way (as a result, to send out another IR command to control another devices).
I have an external IR receiver from a B&O link room system that has a receiver and processor. It works on 5v DC that I supply from the Arduino. Data output is connected to a digital pin 2. When I send an IR command and keep reading the digital pin 2 I got a series of 0s and 1s depending on a command.
Fe. running this:
void setup() {
Serial.begin(9600);
pinMode(2, INPUT);
}
void loop() {
int data = digitalRead(2);
Serial.println(data, DEC);
}
I got stuff like this: 01111111101110110110110110110110111101100110110110110110 (with infinite number of 1s (it might be good idea to invert the read as 1 seems to indicate low now) before and after.)
How can I capture a string of the input? The commands are quite different and I wouldn't need many so comparing only the beginning of a command string (like 5-10 characters) should be enough. Or should I approach this in some other way? I will get on to the IR sending (fe. Apple Remote commands to control my MacBook) later when I get the receiving part working.