Design:
On the breadboard:
How it works:
http://www.youtube.com/watch?v=YG4yLwIarb4
Code:
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace ShutterRelease { public class Program { static Boolean status = false; public static void Main() { // write your code here OutputPort focus = new OutputPort(Pins.GPIO_PIN_D8, false); OutputPort shutter = new OutputPort(Pins.GPIO_PIN_D10, false); InterruptPort button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); button.OnInterrupt += new NativeEventHandler(button_OnInterrupt); while (true) { if (status) { focus.Write(true); shutter.Write(true); Thread.Sleep(10); focus.Write(false); shutter.Write(false); Thread.Sleep(5000); } } } static void button_OnInterrupt(uint data1, uint data2, DateTime time) { status = !status; } } }