diff --git a/synchronizer/blu-ray/Sony_BDP-S790/Toshiba_SD1091EKE.pde b/synchronizer/blu-ray/Sony_BDP_S790/Sony_BDP_S790.pde similarity index 93% rename from synchronizer/blu-ray/Sony_BDP-S790/Toshiba_SD1091EKE.pde rename to synchronizer/blu-ray/Sony_BDP_S790/Sony_BDP_S790.pde index 685d30a..3eae702 100755 --- a/synchronizer/blu-ray/Sony_BDP-S790/Toshiba_SD1091EKE.pde +++ b/synchronizer/blu-ray/Sony_BDP_S790/Sony_BDP_S790.pde @@ -18,6 +18,8 @@ const string SVNID="$Id$"; #include #include +#include +#include int pinGND=4; // Longer leg on the IR LED int pinLED=13; // The heartbeat LED on the board @@ -39,6 +41,7 @@ void setup() { pinMode(pinGND,OUTPUT); pinMode(pinLED,OUTPUT); Serial.begin(115200); + setTime(23,15,16,1,14,14); // set time to 23:15:16 Jan 14 2014 Serial << DESCRIPTION << REVISION << endl; Serial << "Code by " << AUTHOR << endl; @@ -47,12 +50,28 @@ void setup() { Serial << "Playtime: " << endl; secs=playtime; showtime(); - secs=playtime; + Alarm.timerRepeat(playtime, sync); } /********************************************************************/ void loop() { + heartbeat() +} + +void heartbeat() { + if (heartbeat == 1) { + digitalWrite(pinLED, HIGH); + heartbeat = 0; + } + else { + digitalWrite(pinLED, LOW); + heartbeat = 1; + } + Alarm.delay(1000); +} + +void sync() { Serial << "Sync" << endl; // The DVD player starts playing automatically, so we should pause it send_pause(); @@ -67,23 +86,12 @@ void loop() { // The most critical is having everything start at the // same time. showtime(); - if (heartbeat == 1) { - digitalWrite(pinLED, HIGH); - heartbeat = 0; - } - else { - digitalWrite(pinLED, LOW); - heartbeat = 1; - } - delay(1000); - } - } /**************************************************************/ void waitsec(int sec) { Serial << "Wait " << sec << " seconds" << endl; - delay(sec*1000); + Alarm.delay(sec*1000); }