completed and tested Sony BDP-5790 synchronizer, need to sanitize and push the code to the other versions
This commit is contained in:
@@ -8,6 +8,8 @@ const String SVN_ID="$Id$";
|
|||||||
* Requires libraries:
|
* Requires libraries:
|
||||||
* Arduino-IRremote https://github.com/shirriff/Arduino-IRremote
|
* Arduino-IRremote https://github.com/shirriff/Arduino-IRremote
|
||||||
* Streaming http://arduiniana.org/libraries/streaming/
|
* Streaming http://arduiniana.org/libraries/streaming/
|
||||||
|
* Time http://www.pjrc.com/teensy/td_libs_Time.html
|
||||||
|
* TimeAlarms http://www.pjrc.com/teensy/td_libs_TimeAlarms.html
|
||||||
* More codes at http://www.lirc.org/
|
* More codes at http://www.lirc.org/
|
||||||
* This uses remote Sony RMT-B122P
|
* This uses remote Sony RMT-B122P
|
||||||
*
|
*
|
||||||
@@ -21,7 +23,8 @@ const String SVN_ID="$Id$";
|
|||||||
#include <Streaming.h>
|
#include <Streaming.h>
|
||||||
#include <Time.h>
|
#include <Time.h>
|
||||||
#include <TimeAlarms.h>
|
#include <TimeAlarms.h>
|
||||||
int pinGND=4; // Longer leg on the IR LED
|
// IR LED pin 3 should be longer
|
||||||
|
int pinGND=4; // Shorter leg on the IR LED
|
||||||
int pinLED=13; // The heartbeat LED on the board
|
int pinLED=13; // The heartbeat LED on the board
|
||||||
|
|
||||||
int secs;
|
int secs;
|
||||||
@@ -30,15 +33,17 @@ int heartbeat_state=0;
|
|||||||
String INST_NAME="Trajectories";
|
String INST_NAME="Trajectories";
|
||||||
String ARTIST="Sigurdur Gudjonsson (video) & Anna Thorvaldsdottir (sound)";
|
String ARTIST="Sigurdur Gudjonsson (video) & Anna Thorvaldsdottir (sound)";
|
||||||
String YEAR="2014";
|
String YEAR="2014";
|
||||||
int videotime = 14*60+44; // set here your DVD title playtime in sec
|
//int videotime = 14*60+44; // set here your DVD title playtime in seconds
|
||||||
|
int videotime = 5*60; // set here your DVD title playtime in sec
|
||||||
int choptime = 3; // how much to chop at the end if the videos are
|
int choptime = 3; // how much to chop at the end if the videos are
|
||||||
// not exactly the same length
|
// not exactly the same length
|
||||||
int playtime = videotime - choptime;
|
int playtime = videotime - choptime;
|
||||||
int resetdelay = 3; // seconds from reset to playing from beginning
|
int resetdelay = 3; // seconds from reset to playing from beginning
|
||||||
|
|
||||||
IRsend irsend;
|
IRsend irsend;
|
||||||
|
int alarm_bell = false;
|
||||||
|
|
||||||
void showtime() {
|
void showtime(int secs) {
|
||||||
Serial << "sec:" << secs << " / mm:ss " << secs/60 << ":" << secs % 60 << endl;
|
Serial << "sec:" << secs << " / mm:ss " << secs/60 << ":" << secs % 60 << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,14 +58,21 @@ void setup() {
|
|||||||
Serial << "For \""<< INST_NAME << "\" by "<< ARTIST <<"(" << YEAR << ")" << endl;
|
Serial << "For \""<< INST_NAME << "\" by "<< ARTIST <<"(" << YEAR << ")" << endl;
|
||||||
Serial << SVN_URL << endl << SVN_ID << endl;
|
Serial << SVN_URL << endl << SVN_ID << endl;
|
||||||
Serial << "Playtime: " << playtime << endl;
|
Serial << "Playtime: " << playtime << endl;
|
||||||
secs=playtime;
|
sync();
|
||||||
showtime();
|
showtime(playtime);
|
||||||
|
|
||||||
Alarm.timerRepeat(playtime, sync);
|
Alarm.timerRepeat(playtime, trigger_sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void trigger_sync() {
|
||||||
|
alarm_bell = true;
|
||||||
|
}
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void loop() {
|
void loop() {
|
||||||
|
if (alarm_bell == true) {
|
||||||
|
sync();
|
||||||
|
alarm_bell = false;
|
||||||
|
}
|
||||||
heartbeat();
|
heartbeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,19 +90,10 @@ void heartbeat() {
|
|||||||
|
|
||||||
void sync() {
|
void sync() {
|
||||||
Serial << "Sync" << endl;
|
Serial << "Sync" << endl;
|
||||||
send_pause();
|
//send_pause();
|
||||||
waitsec(resetdelay);
|
//waitsec(resetdelay);
|
||||||
|
|
||||||
send_previous();
|
send_previous();
|
||||||
|
|
||||||
/* 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.
|
|
||||||
showtime();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
@@ -104,14 +107,14 @@ void waitsec(int sec) {
|
|||||||
// NEC data format: first comes the pre-data bits, then the command code
|
// NEC data format: first comes the pre-data bits, then the command code
|
||||||
void send_stop() {
|
void send_stop() {
|
||||||
Serial << " stop" << endl;
|
Serial << " stop" << endl;
|
||||||
irsend.sendNEC(0xA25D28D7,32);
|
irsend.sendSony(0x18B47,20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void send_play() {
|
void send_play() {
|
||||||
// Note that play and pause are a toggle for the same command
|
// Note that play and pause are a toggle for the same command
|
||||||
Serial << " play" << endl;
|
Serial << " play" << endl;
|
||||||
irsend.sendNEC(0xA25DA857, 32);
|
irsend.sendSony(0x58B47,20);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,12 +124,12 @@ void send_pause() {
|
|||||||
// We use the "step" command which will always pause, no matter
|
// We use the "step" command which will always pause, no matter
|
||||||
// how many times we press it.
|
// how many times we press it.
|
||||||
Serial << " step/pause" << endl;
|
Serial << " step/pause" << endl;
|
||||||
irsend.sendNEC(0xA25D00FF,32);
|
irsend.sendSony(0x98B47,20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void send_previous() {
|
void send_previous() {
|
||||||
// First comes the pre-data bits, then the command code
|
// First comes the pre-data bits, then the command code
|
||||||
Serial.println(" previous");
|
Serial.println(" previous");
|
||||||
irsend.sendNEC(0xA25DC43B, 32);
|
irsend.sendSony(0xEAB47,20);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user