The mistery continues.
The code is exactly the same.
I have a visible led and I can see it blinking at the same way the duemilanove does. When I connect the IR led to the duemilanove and the Gamebuino and see them through a camera I can see them blinking too.
It is not the intensity, cause the duemilanove signal is able to go through a whole room and the gamebuino signal even at 0 cm doesnt trigger the camera.
I've built a circuit with a transistor too, but it doesnt work either.
The code is this:
- Code: Select all
int shotcode[] = {
1,0,1,1,0,1,0,0,1,0,1,1,1,0,0,0,1,1,1,1}; // Code to send Shutter release command B4B8F
int shotcode_delayed[] = {
1,1,1,0,1,1,0,0,1,0,1,1,1,0,0,0,1,1,1,1}; // // Code to send 2 X delay Shutter release command ECB8F
void shot(int bits[]){
gb.sound.playTick();
for (int i=1; i <= 3; i++) // Send Command 3 times as per Sony Specs
{
header(); // Send the Start header
for (int i=0; i <= 19; i++) // Loop to send the bits
{
if(bits[i] == 1) // Is Data_is_One to be sent ?
{
Data_is_One(); // Yes, send a Data_is_One bit
}
else // No, Data_is_Zero to be sent
{
Data_is_Zero(); // Send a Data_is_Zero bit
}
}
delay(11); // Delay Padding to give approx 45mS between command starts
}
}
// Routine to give the 40kHz burst signal
void burst() // 40KHz burst
{
digitalWrite(IR_LED, HIGH); // sets the pin on
delayMicroseconds(10); // pauses for 13 microseconds (fudged to 10uS Delay)
digitalWrite(IR_LED, LOW); // sets the pin off
delayMicroseconds(8); // pauses for 12 microseconds (fudged to 8uS Delay)
}
// Routine to give a quiet period of data
void quiet() // Quiet burst
{
digitalWrite(IR_LED, LOW); // sets the pin off
delayMicroseconds(10); // pauses for 13 microseconds (fudged to 10uS Delay)
digitalWrite(IR_LED, LOW); // sets the pin off
delayMicroseconds(8); // pauses for 12 microseconds (fudged to 8uS Delay)
}
// Routine to send header data burst
// This allows the IR reciever to set its AGC (Gain)
// Header Burst Timing is 96 * 0.025uS = 2.4mS
// Quiet Timing is 24 * 0.025uS = 600uS
void header()
{
for (int i=1; i <= 96; i++){
burst(); // 40kHz burst
}
for (int i=1; i <= 24; i++){
quiet(); // No 40 kHz
}
}
// Routine to send one data burst
// Burst Timing is 48 * 0.025uS = 1.2mS
// Quiet Timing is 24 * 0.025uS = 600uS
void Data_is_One()
{
for (int i=1; i <= 48; i++){
burst(); // 40kHz burst
}
for (int i=1; i <= 24; i++){
quiet(); // No 40 kHz
}
}
// Routine to send zero data burst
// Burst Timing is 24 * 0.025uS = 600uS
// Quiet Timing is 24 * 0.025uS = 600uS
void Data_is_Zero()
{
for (int i=1; i <= 24; i++){
burst(); // 40 kHz burst
}
for (int i=1; i <= 24; i++){
quiet(); // No 40 kHz
}
}
Hum, there is a small detail that could be useful... at the beginning of the shot function I make a call to playTick...and the tick never comes... mmm..maybe the speaker is responsible for that?