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

Polarity Problem


  • Please log in to reply
2 replies to this topic

#1 B9Brew

B9Brew

    New Member

  • Members
  • Pip
  • 3 posts

Posted 01 March 2012 - 03:50 AM

Hello users,

I've been working through the Get Started with Netduino e-book using the Netduino Plus. All projects have worked fine until the "Mixing Colors" project in chapter 6. I've tried with the maker shield and with the breadboard and in both cases my RGB LED acts like its common is an anode rather than a cathode - i can't get the LED to light up unless i put a GIO_Pin_D9 (or 5 or 6) on the common with the ground on a leg (after a resistor). Do I need to initialize something? the code is simple:
        public static void Main()
        {
            // write your code here
            PWM redLed = new PWM(Pins.GPIO_PIN_D9);
            PWM greenLed = new PWM(Pins.GPIO_PIN_D6);
            PWM blueLed = new PWM(Pins.GPIO_PIN_D5);

            
            redLed.SetDutyCycle(100);
            greenLed.SetDutyCycle(30);
            blueLed.SetDutyCycle(60);

            Thread.Sleep(Timeout.Infinite);
        }


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 01 March 2012 - 04:23 AM

Hi B9Brew, Can you explain your scenario in a bit more detail? Perhaps take a photo of the part, provide its part number, etc.? If your pin is common anode rather than common cathode, PWM may not work for you (unless you modify the native code underneath to cycle between high-z and output low). You really want a common cathode RGB LED. Chris

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 01 March 2012 - 10:41 AM

For common anode RGB LED, connect the anode to VCC and R/G/B cathodes to Netduino PWM pins (through the resistors), PWM will work inversely: 0% duty cycle = on, 100% = off (the LED is on when the pin output is logic low). Also make sure you don't exceed Netduino max pin current, you'd probably need transistors...




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.