starting a new fork of the synchronizer code for blu-ray players and using the Streaming library for serial output.
This commit is contained in:
119
synchronizer/blu-ray/Sony_BDP-S790/Toshiba_SD1091EKE.pde
Executable file
119
synchronizer/blu-ray/Sony_BDP-S790/Toshiba_SD1091EKE.pde
Executable file
@@ -0,0 +1,119 @@
|
|||||||
|
const string DESCRIPTION="IR Synchronizer for Sony Blu-ray player BDP-S790";
|
||||||
|
const string AUTHOR="Joe Foley <foley@ru.is>";
|
||||||
|
const string REVISION="$Rev$";
|
||||||
|
const string SVNID="$Id$";
|
||||||
|
/* Code written by Joe Foley <foley@ru.is> on 2014-01-14
|
||||||
|
*
|
||||||
|
* Requires libraries:
|
||||||
|
* Arduino-IRremote https://github.com/shirriff/Arduino-IRremote
|
||||||
|
* Streaming http://arduiniana.org/libraries/streaming/
|
||||||
|
* More codes at http://www.lirc.org/
|
||||||
|
* This uses remote Sony RMT-B122P
|
||||||
|
*
|
||||||
|
* 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>
|
||||||
|
#include <Streaming.h>
|
||||||
|
int pinGND=4; // Longer leg on the IR LED
|
||||||
|
int pinLED=13; // The heartbeat LED on the board
|
||||||
|
|
||||||
|
int secs;
|
||||||
|
int heartbeat=0;
|
||||||
|
|
||||||
|
string INST_NAME="<Installation Name>";
|
||||||
|
string ARTIST="<Artist>";
|
||||||
|
string YEAR="<Year>";
|
||||||
|
int playtime= 1*60+1; // set here your DVD title playtime in sec leave a little extra
|
||||||
|
|
||||||
|
IRsend irsend;
|
||||||
|
|
||||||
|
void showtime() {
|
||||||
|
Serial << "sec:" << secs << " / mm:ss " << secs/60 << ":" << secs % 60 << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(pinGND,OUTPUT);
|
||||||
|
pinMode(pinLED,OUTPUT);
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
Serial << DESCRIPTION << REVISION << endl;
|
||||||
|
Serial << "Code by " << AUTHOR << endl;
|
||||||
|
Serial << "For \""<< INST_NAME << "\" by "<< ARTIST <<"(" << YEAR << ")" << endl;
|
||||||
|
Serial << URL << endl << ID << endl;;
|
||||||
|
Serial << "Playtime: " << endl;
|
||||||
|
secs=playtime;
|
||||||
|
showtime();
|
||||||
|
secs=playtime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
void loop() {
|
||||||
|
Serial << "Sync" << endl;
|
||||||
|
// The DVD player starts playing automatically, so we should pause it
|
||||||
|
send_pause();
|
||||||
|
waitsec(2);
|
||||||
|
|
||||||
|
send_previous();
|
||||||
|
// on this model, previous immediately starts playing
|
||||||
|
|
||||||
|
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();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
// NEC data format: first comes the pre-data bits, then the command code
|
||||||
|
void send_stop() {
|
||||||
|
Serial << " stop" << endl;
|
||||||
|
irsend.sendNEC(0xA25D28D7,32);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
void send_play() {
|
||||||
|
// Note that play and pause are a toggle for the same command
|
||||||
|
Serial << " play" << endl;
|
||||||
|
irsend.sendNEC(0xA25DA857, 32);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
void send_pause() {
|
||||||
|
// On this model, pause and play are the same button so it toggles
|
||||||
|
// We use the "step" command which will always pause, no matter
|
||||||
|
// how many times we press it.
|
||||||
|
Serial << " step/pause" << endl;
|
||||||
|
irsend.sendNEC(0xA25D00FF,32);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
void send_previous() {
|
||||||
|
// First comes the pre-data bits, then the command code
|
||||||
|
Serial.println(" previous");
|
||||||
|
irsend.sendNEC(0xA25DC43B, 32);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user