Hi All,
I am trying to control a video camera using an arduino. The buttons are attached to a thin membrane going to a small zif socket and I've had no luck attaching the mini pro to them. My current idea is to use the IR in to control the device. I have downloaded the codes from the remote control using IRremote library and have followed this thread Bypassing IR control on HDMI switcher - Project Guidance - Arduino Forum for inspiration but the camera is not responding to any of my commands.
The code I am currently using is:
#include <IRremote.h>
// pulse parameters in usec
#define NEC_HDR_MARK 9000
#define NEC_HDR_SPACE 4500
#define NEC_BIT_MARK 560
#define NEC_ONE_SPACE 1600
#define NEC_ZERO_SPACE 560
#define NEC_RPT_SPACE 2250
#define TOPBIT 0x80000000
const int OutputPin = 11;
IRsend irsend;
void setup(){
Serial.begin(9600);
pinMode(OutputPin, OUTPUT);
}
void loop(){
Serial.println("Sending");
irsend.sendNEC(0x807F56A9, 32);
delay(2000);
}
void sendNEC(unsigned long data, int nbits) {
mark(NEC_HDR_MARK);
space(NEC_HDR_SPACE);
for (int i = 0; i < nbits; i++) {
if (data & TOPBIT) {
mark(NEC_BIT_MARK);
space(NEC_ONE_SPACE);
}
else {
mark(NEC_BIT_MARK);
space(NEC_ZERO_SPACE);
}
data <<= 1;
}
mark(NEC_BIT_MARK);
space(0);
}
void mark(int time) {
digitalWrite(OutputPin, LOW);
delayMicroseconds(time);
}
void space(int time) {
digitalWrite(OutputPin, HIGH);
delayMicroseconds(time);
}
The IR code is correct and responds correctly when actually using the remote so I am at a loss as to where I have gone wrong. Any ideas appreciated.
Thanks,
Jon