merging sigrun Synchronizer_long_philips into the main branch
This commit is contained in:
@@ -1,135 +0,0 @@
|
||||
/* DVD IR Synchronizer for Philips DVP3142/12
|
||||
* Developed for Art Installation "Thor"
|
||||
* Code written by Joe Foley <foley@ru.is>
|
||||
* on 2013-09-08
|
||||
*
|
||||
*
|
||||
* Requires libraries:
|
||||
* Arduino-IRremote https://github.com/shirriff/Arduino-IRremote
|
||||
* Instructions http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
|
||||
*
|
||||
* IR Remote codes from IRrecvDemo
|
||||
*
|
||||
*
|
||||
* Details on the Philips RC6 coding
|
||||
* http://www.pcbheaven.com/userpages/The_Philips_RC6_Protocol/
|
||||
*
|
||||
* 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;
|
||||
// Sarcity 20:58
|
||||
int playtime= 58*44+10; // Play time in seconds, you usually leave off a second or two
|
||||
|
||||
//int playtime= 10; // testing
|
||||
|
||||
IRsend irsend;
|
||||
|
||||
void setup() {
|
||||
pinMode(pinGND,OUTPUT);
|
||||
pinMode(pinLED,OUTPUT);
|
||||
Serial.begin(115200);
|
||||
|
||||
Serial.println("Panasonic DVD DVP-3142/12 Synchronizer $Rev: 29 $");
|
||||
Serial.println("For \"Sarcity\" by Thor Elis (1981)");
|
||||
Serial.println("Code by Joe Foley <foley@ru.is>");
|
||||
Serial.println("$URL: https://svn.ru.is/projects/arduino-art/dawn/Synchronizer_Philips_DVP3142_12/Synchronizer_Philips_DVP3142_12.pde $");
|
||||
Serial.println("$Id: Synchronizer_Philips_DVP3142_12.pde 29 2013-09-13 19:37:53Z foley@ru.is $");
|
||||
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("");
|
||||
|
||||
secs=playtime;
|
||||
send_play();
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
void loop() {
|
||||
Serial.println("Sync");
|
||||
//send_pause();
|
||||
//waitsec(2);
|
||||
|
||||
// The three players don't always see the "previous command" so we send it multiple times
|
||||
send_previous();
|
||||
send_previous();
|
||||
send_previous();
|
||||
//waitsec(2);
|
||||
// Don't send play because previous automatically starts it
|
||||
// If we hit play it will merely pause it.
|
||||
//send_play();
|
||||
|
||||
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.sendRC6(0x10431,20);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
void send_play() {
|
||||
// First comes the pre-data bits, then the command code
|
||||
Serial.println(" play");
|
||||
irsend.sendRC6(0x1042C,20);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
void send_pause() {
|
||||
// First comes the pre-data bits, then the command code
|
||||
Serial.println(" pause");
|
||||
irsend.sendRC6(0x1042C,20);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
void send_previous() {
|
||||
// First comes the pre-data bits, then the command code
|
||||
Serial.println(" previous");
|
||||
irsend.sendRC6(0x10421, 20);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ int pinLED=13; // The heartbeat LED on the board
|
||||
int heartbeat=0;
|
||||
int secs;
|
||||
// Sarcity 20:58
|
||||
int playtime= 22*60+10; // Play time in seconds, you usually leave off a second or two
|
||||
int playtime= 58*44+10; // Play time in seconds, you usually leave off a second or two
|
||||
|
||||
//int playtime= 10; // testing
|
||||
|
||||
@@ -132,4 +132,4 @@ void send_previous() {
|
||||
// First comes the pre-data bits, then the command code
|
||||
Serial.println(" previous");
|
||||
irsend.sendRC6(0x10421, 20);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user