@nitrogen - Try this sketch...
// Testing Samsung / Mitsubishi 3D shutter glasses at 120Hz.
// (using Samsung 2010 IR protocol!) OzOnE.
int IRledPin = 3; // IR LED connected to digital pin 13 (@nitrogen - is this meant to be 3 ?)
// 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() {
samsung_ir_pulse(); // This should start with the RIGHT shutter clear first (the Mitsubishi glasses apparently start with the LEFT).
delayMicroseconds(8333); // Wait for FOUR frames to pass (@120Hz), before next IR pulse.
delayMicroseconds(8333); // (the glasses will auto-shutter RIGHT/LEFT/RIGHT/LEFT during this time)
delayMicroseconds(8333);
delayMicroseconds(8333);
}
void samsung_ir_pulse() {
cli(); // Turn off any background interrupts (temporarily).
digitalWrite(IRledPin, HIGH); // this takes about 3 microseconds to happen
delayMicroseconds(14); // I actually want around 17uS, so we subtract the 3uS.
digitalWrite(IRledPin, LOW); // this takes about 3 microseconds to happen
delayMicroseconds(29); // I actually want around 32uS, so we subtract the 3uS.
digitalWrite(IRledPin, HIGH);
delayMicroseconds(14);
digitalWrite(IRledPin, LOW);
delayMicroseconds(29);
digitalWrite(IRledPin, HIGH);
delayMicroseconds(14);
digitalWrite(IRledPin, LOW);
sei(); // Turn interrupts back on!
}
I haven't tested this code yet, but hopefully it will work for very basic testing.
If you want to sync the glasses to an external trigger (VSYNC or VESA), then you might need to do some frame counting, so it only outputs a pulse once every four frames.
It shouldn't need a carrier routine because the above pulses directly generate the carrier at around 20,576Hz.
I took the delay timings from the Woods / Helliwell PDF, so I don't know what the REAL carrier is supposed to be?
I had to "round" the microseconds a bit though, so the actual output should be closer to 20,408Hz.
If it doesn't work too well at first, try changing the "(29)"s to "(28)"s.
The glasses seem quite forgiving with the pulses. As I say, they also work with just a single pulse!
I guess the idea of using a carrier is to give better immunity from external IR interference and normal remote controls.
In theory, the carrier might increase the range too.
(btw, I split the frames delay into four separate "delayMicroseconds(8333)" statements because the maximum delay is 16,383 before the timer starts loosing accuracy.)
Let me know if it works!
It should only need to be simple like the above code - try not to rely on the Arduino libraries too much if it can be done more easily at a lower level.
Many of those IR libraries are designed mainly with Remote Controls in mind, so capturing a 3D emitter might cause strange results.
OzOnE.