Hi guys,
the idea is to have this IR controlled box that will interface with a slide projector, and allow me to remote control it with a common TV IR remote.
The output of this box will interface with the projector with a relay, that is closed for a short time, generating a pulse that moves the tray and activates the slide loading sequence.
I was thinking of the modes, using 2 buttons on the remote (let's call them SINGLE and AUTO):
one click on SINGLE will advance of one slide only
one click on AUTO will activate the timed sequence:
it will load the slide, wait for the time defined by the value read on a pot (to have an adjustable time delay), then load the next slide,and repeat the sequence until I cklick on the same button AUTO again.
I'm away from home and I don't have any board with me, so I can only play with the code for the moment.
How does it look?
Did I got anything wrong?
Thanks
#include <IRremote.h>
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
#define OUT_FWD 2 //
#define OUT_REV 4 //
#define POT_TD A0 //
int PULSE = 350;
int TIMER ;
int AUTO_FWD = 0; //
int AUTO_FWD_START = 0; //
int AUTO_REV = 0; //
void setup() {
Serial.begin(9600); //
irrecv.enableIRIn(); //
irrecv.blink13(true); //
pinMode(OUT_FWD, OUTPUT); //
pinMode(OUT_REV, OUTPUT); //
digitalWrite(OUT_FWD, HIGH); //
digitalWrite(OUT_REV, HIGH); //
}
void loop() {
Serial.print("HEX: ");
Serial.print(results.value, HEX);
int TIMER = map(POT_TD, 0, 1023, 1500, 3000);
if (irrecv.decode(&results))
{
switch (results.value) {
case 0x410: //
digitalWrite(OUT_FWD, LOW); //
delay(PULSE); //
digitalWrite(OUT_FWD, HIGH); //
break;
// case 0x10: //
// digitalWrite(OUT_REV, LOW); //
// delay(PULSE); //
// digitalWrite(OUT_REV, HIGH); //
// break;
case 0x15: //
if (AUTO_FWD == 0) { //
digitalWrite(AUTO_FWD_START, HIGH); //
AUTO_FWD = 1; //
}
else {
digitalWrite(AUTO_FWD_START, LOW); //
AUTO_FWD = 0; //
}
while ( digitalRead(AUTO_FWD_START) == 1 ) //
digitalWrite(OUT_FWD, LOW); //
delay(PULSE); //
digitalWrite(OUT_FWD, HIGH); //
delay(TIMER); //
//
//
break;
}
irrecv.resume();
}
}