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.

Committer:
viswesr
Date:
Sat Sep 07 04:57:09 2013 +0000
Revision:
5:027426a185b9
Parent:
2:3af381cd3df6
Fix Typo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
viswesr 2:3af381cd3df6 1 /* IR remote for D3200 DSLR camera. Should work with other DSLR cameras that support ML-L3 remote. Implemented with mbed
viswesr 2:3af381cd3df6 2 based on a nice documentation of ML-L3 protocol by Michele Bighignoli (http://www.bigmike.it/ircontrol/) */
viswesr 2:3af381cd3df6 3
simon 0:fb6bbc10ffa0 4 #include "mbed.h"
simon 0:fb6bbc10ffa0 5
viswesr 2:3af381cd3df6 6 /* P0_9 is connected to an IR LED and P1_14 to a button in Seeedstudio Arch.
viswesr 5:027426a185b9 7 Change these pins as per your platform. */
viswesr 2:3af381cd3df6 8 #define LED_PIN P0_9
viswesr 2:3af381cd3df6 9 #define BUTTON_PIN P1_14
viswesr 2:3af381cd3df6 10
viswesr 2:3af381cd3df6 11 PwmOut IRled(LED_PIN); /* Connect a suitable current limiting resistor.
viswesr 2:3af381cd3df6 12 For longer range, use a transistor for driving IR LED */
simon 0:fb6bbc10ffa0 13
viswesr 2:3af381cd3df6 14 DigitalIn button(BUTTON_PIN); /* Push button to enable shutter release */
viswesr 2:3af381cd3df6 15
viswesr 2:3af381cd3df6 16 void shutterrelease();
viswesr 2:3af381cd3df6 17
viswesr 2:3af381cd3df6 18 int main()
viswesr 2:3af381cd3df6 19 {
viswesr 2:3af381cd3df6 20 button.mode(PullDown);
viswesr 2:3af381cd3df6 21 IRled.period_us(26); // set PWM period for Carrier Frequency of 38.4 KHz
viswesr 2:3af381cd3df6 22 IRled.write(0);
viswesr 2:3af381cd3df6 23
simon 0:fb6bbc10ffa0 24 while(1) {
viswesr 2:3af381cd3df6 25 if(button) {
viswesr 2:3af381cd3df6 26 shutterrelease();
viswesr 2:3af381cd3df6 27 }
simon 0:fb6bbc10ffa0 28 }
viswesr 2:3af381cd3df6 29
simon 0:fb6bbc10ffa0 30 }
viswesr 2:3af381cd3df6 31
viswesr 2:3af381cd3df6 32 void shutterrelease()
viswesr 2:3af381cd3df6 33 {
viswesr 2:3af381cd3df6 34 /* Shutter release command sequence */
viswesr 2:3af381cd3df6 35 IRled.write(0.5);
viswesr 2:3af381cd3df6 36 wait_us(2000);
viswesr 2:3af381cd3df6 37 IRled.write(0);
viswesr 2:3af381cd3df6 38 wait_us(27830);
viswesr 2:3af381cd3df6 39 IRled.write(0.5);
viswesr 2:3af381cd3df6 40 wait_us(400);
viswesr 2:3af381cd3df6 41 IRled.write(0);
viswesr 2:3af381cd3df6 42 wait_us(1580);
viswesr 2:3af381cd3df6 43 IRled.write(0.5);
viswesr 2:3af381cd3df6 44 wait_us(400);
viswesr 2:3af381cd3df6 45 IRled.write(0);
viswesr 2:3af381cd3df6 46 wait_us(3580);
viswesr 2:3af381cd3df6 47 IRled.write(0.5);
viswesr 2:3af381cd3df6 48 wait_us(400);
viswesr 2:3af381cd3df6 49 IRled.write(0);
viswesr 2:3af381cd3df6 50 wait_us(63200); // Wait for 63.2ms and repeat the above sequence.
viswesr 2:3af381cd3df6 51 IRled.write(0.5);
viswesr 2:3af381cd3df6 52 wait_us(2000);
viswesr 2:3af381cd3df6 53 IRled.write(0);
viswesr 2:3af381cd3df6 54 wait_us(27830);
viswesr 2:3af381cd3df6 55 IRled.write(0.5);
viswesr 2:3af381cd3df6 56 wait_us(400);
viswesr 2:3af381cd3df6 57 IRled.write(0);
viswesr 2:3af381cd3df6 58 wait_us(1580);
viswesr 2:3af381cd3df6 59 IRled.write(0.5);
viswesr 2:3af381cd3df6 60 wait_us(400);
viswesr 2:3af381cd3df6 61 IRled.write(0);
viswesr 2:3af381cd3df6 62 wait_us(3580);
viswesr 2:3af381cd3df6 63 IRled.write(0.5);
viswesr 2:3af381cd3df6 64 wait_us(400);
viswesr 2:3af381cd3df6 65 IRled.write(0);
viswesr 2:3af381cd3df6 66 }