Files
arduino-art/dawn/Synchronizer_Toshiba_SD590EKE/Synchronizer_Toshiba_SD590EKE.pde

128 lines
3.3 KiB
Plaintext

/* DVD IR Synchronizer for Toshiba SD590EKE
* Developed for Art Installation "Dawn" by Sigrun Hardardottir<sigrun@stalverk.is>
* Code written by Joe Foley <foley@ru.is>
* on 2013-09-08
*
* Requires libraries:
* Arduino-IRremote https://github.com/shirriff/Arduino-IRremote
*
* IR Remote codes from SE-R0313
* http://lirc.sourceforge.net/remotes/toshiba/SE-R0313
*
* The IRremote library uses Pin 3 for the Anode (longer pin)
* We have made a ground pin on Pin 4 for the Cathode (shorter pin)
*/
#include <IRremote.h>
int pinGND=4; // Longer leg on the IR LED
int pinLED=13; // The heartbeat LED on the board
int heartbeat=0;
int secs;
// Dawn 6:09
int playtime= 6*60+8; // set here your DVD title playtime in sec leave a little extra
IRsend irsend;
void setup() {
pinMode(pinGND,OUTPUT);
pinMode(pinLED,OUTPUT);
Serial.begin(115200);
Serial.println("Toshiba DVD SD590EKE Synchronizer $Rev$");
Serial.println("For \"Dawn\" by Sigrun Hardar on 1986");
Serial.println("Code by Joe Foley <foley@ru.is>");
Serial.println("$URL$");
Serial.println("$Id$");
Serial.print("Playtime: ");
secs=playtime;
Serial.print("sec:");
Serial.print(secs);
Serial.print(" / mm:ss ");
Serial.print(secs/60);
Serial.print(":");
Serial.print(secs % 60);
Serial.println("");
// The DVD player starts playing automatically, so we should pause it
send_pause();
waitsec(2);
secs=playtime;
}
/********************************************************************/
void loop() {
Serial.println("Sync");
send_pause();
waitsec(2);
send_previous();
//waitsec(2);
send_play(); // this should not be necessary, but just in case
for(int t = 0; t < playtime; t++) {
// This will not give us perfect 1 second timing
// but it is good enough for most video applications
// The most critical is having everything start at the
// same time.
Serial.print("sec:");
Serial.print(playtime);
Serial.print(" / mm:ss ");
Serial.print(t/60);
Serial.print(":");
Serial.print(t % 60);
Serial.println("");
if (heartbeat == 1) {
digitalWrite(pinLED, HIGH);
heartbeat = 0;
}
else {
digitalWrite(pinLED, LOW);
heartbeat = 1;
}
delay(1000);
}
}
/**************************************************************/
void waitsec(int sec) {
Serial.print("Wait ");
Serial.print(sec);
Serial.println(" seconds");
delay(sec*1000);
}
/********************************************************************/
void send_stop() {
// First comes the pre-data bits, then the command code
Serial.println(" stop");
irsend.sendNEC(0xA25D28D7,32);
}
/********************************************************************/
void send_play() {
// First comes the pre-data bits, then the command code
Serial.println(" play");
irsend.sendNEC(0xA25DA857,32);
}
/********************************************************************/
void send_pause() {
// First comes the pre-data bits, then the command code
Serial.println(" pause");
irsend.sendNEC(0xA25D00FF, 32);
}
/********************************************************************/
void send_previous() {
// First comes the pre-data bits, then the command code
Serial.println(" previous");
irsend.sendNEC(0xA25DC43B, 32);
}