Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

LED dim


  • Please log in to reply
4 replies to this topic

#1 Toon

Toon

    New Member

  • Members
  • Pip
  • 7 posts

Posted 18 February 2013 - 03:15 AM

Does anyone know a good code to use for dimming an LED connected to a potentiometer?



#2 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

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 Toon

Toon

    New Member

  • Members
  • Pip
  • 7 posts

Posted 18 February 2013 - 03:46 AM

Thanks



#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

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 Toon

Toon

    New Member

  • Members
  • Pip
  • 7 posts

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

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.