Control the led intensity with a potentiometer that controls the duty cycle of a PWM port.
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
namespace NetduinoPlusApplication1
{
public class Program
{
public static void Main()
{
PWM blue_led = new PWM(PWMChannels.PWM_PIN_D5, 100, 50, false);
AnalogInput pot = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);
double pot_value = 0;
while (true)
{
pot_value = pot.Read();
Debug.Print(pot_value.ToString());
Debug.Print(pot.Read().ToString());
blue_led.DutyCycle = pot_value;
//blue_led.DutyCycle = .9;
}
}
}
}