by wnc » Tue May 08, 2012 9:04 pm
Hi
Here is the code. As I said earlier, I just modify the codes to serve the purpose. I have tested the sketch that it transmit the code(IR signals). Because I monitor the signals by installing IRreceiver&LED. However my Pioneer banned player did not play. The attached code is for Pioneer "Play" signal.
Help me to check whether my sketch is correct.
============================================xxx===================================
#include "ircodes.h"
int IRledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the IR digital pin as an output:
pinMode(IRledPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Serial.println("Sending IR signal");
SendNikonCode();
delay(60*1000); // wait one minute (60 seconds * 1000 milliseconds)
}
// This procedure sends a 38KHz pulse to the IRledPin
// for a certain # of microseconds. We'll use this whenever we need to send codes
void pulseIR(long microsecs) {
// we'll count down from the number of microseconds we are told to wait
cli(); // this turns off any background interrupts
while (microsecs > 0) {
// 38 kHz is about 13 microseconds high and 13 microseconds low
digitalWrite(IRledPin, HIGH); // this takes about 3 microseconds to happen
delayMicroseconds(10); // hang out for 10 microseconds
digitalWrite(IRledPin, LOW); // this also takes about 3 microseconds
delayMicroseconds(10); // hang out for 10 microseconds
// so 26 microseconds altogether
microsecs -= 26;
}
sei(); // this turns them back on
}
void SendNikonCode() {
// This is the code for my particular Nikon, for others use the tutorial
// to 'grab' the proper code from the remote
for(int i=0; i<80;i++) {
pulseIR(ApplePlaySignal[i*2+0]);
delay(ApplePlaySignal[i*2+1]);}
}
=========================+++==================Below is the H file
long ApplePlaySignal[]={
// ON, OFF (in 10's of microseconds) play button
834, 414,
54, 152,
54, 154,
54, 52,
52, 52,
50, 54,
50, 154,
54, 52,
52, 152,
54, 52,
52, 52,
52, 154,
54, 152,
54, 152,
56, 52,
52, 152,
54, 52,
50, 54,
50, 154,
54, 154,
52, 154,
54, 152,
54, 54,
50, 54,
50, 154,
54, 152,
54, 52,
52, 52,
52, 52,
52, 52,
52, 152,
54, 154,
54, 52,
52, 2640,
832, 414,
54, 154,
54, 152,
54, 52,
52, 52,
52, 52,
52, 152,
54, 54,
50, 154,
54, 52,
52, 52,
50, 154,
54, 152,
56, 152,
54, 52,
52, 152,
54, 52,
52, 52,
52, 154,
52, 154,
54, 152,
54, 154,
52, 54,
52, 52,
52, 152,
54, 154,
52, 54,
50, 52,
52, 52,
52, 52,
52, 154,
54, 152,
54, 52,
52, 2638,
834, 414,
54, 152,
54, 154,
52, 54,
52, 52,
50, 54,
50, 154,
54, 52,
54, 54,
50, 0};