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

Oz-Solutions Tutorial: RGB LED


  • Please log in to reply
26 replies to this topic

#21 Guardian

Guardian

    New Member

  • Members
  • Pip
  • 5 posts

Posted 22 December 2012 - 05:01 PM

But it's normal my LED do nothing ? { PWM redLed = new PWM(SecretLabs.NETMF.Hardware.Netduino.PWMChannels.PWM_PIN_D3, 100, 50, false); PWM greenLed = new PWM(SecretLabs.NETMF.Hardware.Netduino.PWMChannels.PWM_PIN_D6, 100, 50, false); PWM blueLed = new PWM(SecretLabs.NETMF.Hardware.Netduino.PWMChannels.PWM_PIN_D5, 100, 50, false); redLed.DutyCycle = 0.5; greenLed.DutyCycle = 0.5; blueLed.DutyCycle = 0.5; Thread.Sleep(Timeout.Infinite); }

#22 rndmhero003

rndmhero003

    New Member

  • Members
  • Pip
  • 1 posts

Posted 24 December 2012 - 06:16 AM

You need to add:

redLed.Start();
greenLed.Start();
blueLed.Start();

I had this same problem and spent an hour trying to figure out what I was doing wrong. Felt pretty dumb when I realized the issue.

#23 Duino_Derp

Duino_Derp

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 December 2012 - 03:33 AM

i tried to put this onto my netduino, but in the debugger, i got an error for every time that setdutycycle appears.. what should i do?

#24 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 28 December 2012 - 02:40 PM

i tried to put this onto my netduino, but in the debugger, i got an error for every time that setdutycycle appears.. what should i do?

 

Hi Duino_Derp and welcome to the community!

 

The SetDutyCycle method is a part of the Secretlabs PWM class, which is not included in the Netduino project's template by default. To add it you will need to:

  • Right click on "References" which can be found in the Solutions Explorer of Visual Studio. Then select Add Reference. 
  • Select "Add References"
  • Then in the ".Net" tab scroll down and locate the "SecretLabs.NETMF.Hardware.PWM" reference. 

If your project already has a reference to the "Microsoft.SPOT.Hardware.PWM", you may need to resolve and define which PWM class you want to use. To do this you can right click on the red underlined code, and select Resolve. In the end you should see something like this (though change the pin to suit your needs):

 

 

SecretLabs.NETMF.Hardware.PWM pwm = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D5);

Alternatively you can just remove the "Microsoft.SPOT.Hardware.PWM" reference from your project. However, I actually prefer the MS one, and I think in the future you'll see more projects using it. 

 

Hopefully this helps!

 

Cheers,

Steve



#25 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 05 April 2013 - 03:32 AM

Hi..

 

I have a problem with the LED color. I am still unsure what is the problem. After typed out all the codes with no error and run the program, the red LED did not even light up at all, the green LED color is so little which hardly to see it, and the blue LED is so bright. I used 100 ohm resistor on red, 105 ohm resistor on green and 250 ohm variable resistor on blue. I have try to swap the resistor but the outcome is still the same. Could anyone please guide me what is the problem here? :(



#26 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 05 April 2013 - 06:03 PM

Hi..

 

I have a problem with the LED color. I am still unsure what is the problem. After typed out all the codes with no error and run the program, the red LED did not even light up at all, the green LED color is so little which hardly to see it, and the blue LED is so bright. I used 100 ohm resistor on red, 105 ohm resistor on green and 250 ohm variable resistor on blue. I have try to swap the resistor but the outcome is still the same. Could anyone please guide me what is the problem here? :(

 

You are correct in that the resistors will vary for different color LEDs but they can also vary for different types of LEDs.  What RGB LED are you using?  May need to look at the specs and recalculate the resistors.  Additionally what power source are you using? 3v? 5v? 12v? and are the LEDs common cathode or common anode?



#27 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 08 April 2013 - 02:02 AM

You are correct in that the resistors will vary for different color LEDs but they can also vary for different types of LEDs.  What RGB LED are you using?  May need to look at the specs and recalculate the resistors.  Additionally what power source are you using? 3v? 5v? 12v? and are the LEDs common cathode or common anode?

 

I am using the RGB Diffused Common Cathode [https://www.sparkfun.com/products/9264]. I did not connect any power source when running the program. I did the same thing as the diagram given. Is my resistor value correct? Connect to red with resistor of brown, black, brown, gold. Connect to green with resistor of brown, black, green, gold. Connect to blue with 250 ohm variable resistor. I have another resistor i have not try which is red, black, orange, gold.

 

Your guidance are really appreciated :)






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.