Does anyone know a good code to use for dimming an LED connected to a potentiometer?
LED dim
#1
Posted 18 February 2013 - 03:15 AM
#2
Posted 18 February 2013 - 03:28 AM
Toon,
I don't have time to look at the moment, but have you tried searching the forum?
The easiest way is to search from google (the forum doesn't find capitalized letters very well ie. LED, PWM)
use:
site:forums.netduino.com led
There should be something there.
Chuck
#3
Posted 18 February 2013 - 03:46 AM
Thanks
#4
Posted 18 February 2013 - 07:39 AM
I guess this has been already posted on the forums, basically what you can do is something like this:
// Written in pseudo-code, does not compilevar potentiometer = new AnalogInput(...);var led = new PWM(...);while(true){ var val = potentiometer.Read(); // TODO: Normalize - divide, or use AnalogInput Range/Scale properties (.NET MF 4.2) led.SetDutyCycle(val); // PWM in 4.2 has DutyCycle property, Start() method Thread.Sleep(25);}
There are two versions of AnalogInput and PWM classes, so the usage (method calls, parameters) can be slightly different - it depends on firmware version .NET MF 4.2 has introduced new AnalogInput and PWM classes, before that they are in SecretLabs assembly.
#5
Posted 19 February 2013 - 03:34 AM
I would like to learn more about .NET MF 4.2 and the two versions of AnalogInput and PWM...what would help me?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users