Shutter release remote for D3200 camera. Should work with other DSLR cameras that support ML-L3 IR remote.

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

Shutter release remote for D3200 camera. Should work with other DSLR cameras that support ML-L3 IR remote.

Revision:
2:3af381cd3df6
Parent:
0:fb6bbc10ffa0
Child:
5:027426a185b9
--- a/main.cpp	Sun Jan 01 20:57:57 2012 +0000
+++ b/main.cpp	Sat Sep 07 04:36:09 2013 +0000
@@ -1,12 +1,66 @@
+/* IR remote for D3200 DSLR camera. Should work with other DSLR cameras that support ML-L3 remote. Implemented with mbed
+   based on a nice documentation of ML-L3 protocol by Michele Bighignoli (http://www.bigmike.it/ircontrol/) */
+
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+/* P0_9 is connected to an IR LED and P1_14 to a button in Seeedstudio Arch.
+   Change this pin as per your platform. */
+#define LED_PIN     P0_9
+#define BUTTON_PIN  P1_14
+
+PwmOut IRled(LED_PIN);     /* Connect a suitable current limiting resistor.
+                              For longer range, use a transistor for driving IR LED */
 
-int main() {
+DigitalIn button(BUTTON_PIN);  /* Push button to enable shutter release */
+
+void shutterrelease();
+
+int main()
+{
+    button.mode(PullDown);
+    IRled.period_us(26);                // set PWM period for Carrier Frequency of 38.4 KHz
+    IRled.write(0);
+
     while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
+        if(button) {
+            shutterrelease();
+        }
     }
+
 }
+
+void shutterrelease()
+{
+    /* Shutter release command sequence */
+    IRled.write(0.5);
+    wait_us(2000);
+    IRled.write(0);
+    wait_us(27830);
+    IRled.write(0.5);
+    wait_us(400);
+    IRled.write(0);
+    wait_us(1580);
+    IRled.write(0.5);
+    wait_us(400);
+    IRled.write(0);
+    wait_us(3580);
+    IRled.write(0.5);
+    wait_us(400);
+    IRled.write(0);
+    wait_us(63200);  // Wait for 63.2ms and repeat the above sequence.
+    IRled.write(0.5);
+    wait_us(2000);
+    IRled.write(0);
+    wait_us(27830);
+    IRled.write(0.5);
+    wait_us(400);
+    IRled.write(0);
+    wait_us(1580);
+    IRled.write(0.5);
+    wait_us(400);
+    IRled.write(0);
+    wait_us(3580);
+    IRled.write(0.5);
+    wait_us(400);
+    IRled.write(0);
+}