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

RGB Led using PWM

RGB Led using PWM

Best Answer tim c , 02 July 2013 - 02:39 PM

There was a naming change between 4.1 and 4.2 and Netduino/N2/N+/N+2. Try the sample in this forum post and see if it works for you:

 

http://forums.netdui...led-pwm-sample/

 

http://forums.netdui...-netduinoplus2/

 

IIRC the change had to do with how you address the PINS.

 

led_r = new PWM([color=rgb(255,0,0);]PWMChannels.PWM_PIN_D9[/color], 100u, 0u, PWM.ScaleFactor.Microseconds, true);

 

Tim

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 Graham.fry

Graham.fry

    Member

  • Members
  • PipPip
  • 15 posts

Posted 02 July 2013 - 11:36 AM

Hi

 

I am trying to get an RGB Led working. I am using some code from the web.

 

The problem is that every time I deploy it, it comes up with the following error:

 

The thread '<No Name>' (0x2) has exited with code 0 (0x0).

A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll

 

and then you an not connect any more you need to flash the firmware to be able to do anything.

 

I am using firm ware 4.2.2.2 and the right SDK 4.2.

 

I have tried different I/O (4,5,6) and combinations.

 

I have tested the board with, a basic blinky app and a push button app and all is working

 

Code sample

 

using System; //use base classes using System.Threading; //use threading classes using Microsoft.SPOT; //use smart personal objects technology classes using Microsoft.SPOT.Hardware; //use hardware related SPOT classes using SecretLabs.NETMF.Hardware; //use Secret Labs hardware framework using SecretLabs.NETMF.Hardware.Netduino; //use the Netduino specific classes

 

namespace NCIR01 /// Define the namespace we are in /// {   public class Program   {   public static void Main() /// The Main loop (run at power up) ///   {   PWM rgb1 = new PWM(Pins.GPIO_PIN_D8);   PWM rgb2 = new PWM(Pins.GPIO_PIN_D9);   PWM rgb3 = new PWM(Pins.GPIO_PIN_D10);

  while (true) /// Do Forever ///   { rgb1.SetDutyCycle(100); rgb2.SetDutyCycle(0); rgb3.SetDutyCycle(0);

  } /// Close Forever Loop ///   } /// Close the Main() Loop ///     } /// Close the Program Loop /// } /// Close the Namespace Loop ///

 

Any ideas would help

 

Thanks

 

Graham

 



#2 tim c

tim c

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

Posted 02 July 2013 - 02:39 PM   Best Answer

There was a naming change between 4.1 and 4.2 and Netduino/N2/N+/N+2. Try the sample in this forum post and see if it works for you:

 

http://forums.netdui...led-pwm-sample/

 

http://forums.netdui...-netduinoplus2/

 

IIRC the change had to do with how you address the PINS.

 

led_r = new PWM([color=rgb(255,0,0);]PWMChannels.PWM_PIN_D9[/color], 100u, 0u, PWM.ScaleFactor.Microseconds, true);

 

Tim



#3 Graham.fry

Graham.fry

    Member

  • Members
  • PipPip
  • 15 posts

Posted 02 July 2013 - 03:04 PM

Thank will try this and let you know






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.