I have sucessfully managed to create a dimmer, initially this was a button triggered dimmer that turned a light on and off in a fading action. This has been refined with a more personal approach and I have managed to take reading from a pot and use this to affect the pwm port in order to dim the light. It's basic but it proves a point.
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace CIRC_08
{
public class Program
{
static OutputPort led = new OutputPort(Pins.GPIO_PIN_D13, false);
static AnalogInput potentiometer = new AnalogInput(Pins.GPIO_PIN_A0);
static PWM pwm = new PWM(Pins.GPIO_PIN_D5);
public static void Main()
{
int sensorValue = 0;
potentiometer.SetRange(0, 100);
while (true)
{
sensorValue = potentiometer.Read();
Debug.Print("pot value = " + sensorValue.ToString());
pwm.SetDutyCycle((uint)sensorValue);
}
}
}
}
Finally I have also ordered some extra bits and pieces, I have 10 shift registers, a real time clock, a new temperature probe and a few other bits on their way. I am currently trying to figure out if I can bypass the 6-7 v vcc on the lcd display I have in order to run it straight off the netduino. The idea being I will play around with the screen a little and then see if I can print my various reading to it. After that it will be logging data to the sd card!
No comments:
Post a Comment