Author Topic: Newb - Digi RGB help - Only Green outputs  (Read 4279 times)

UncleTony

  • Newbie
  • *
  • Posts: 15
Newb - Digi RGB help - Only Green outputs
« on: February 24, 2013, 08:07:01 pm »
Hey everyone, so I fried my last USB but decided to get it a new try. Got the RGB and even the LCD to light up - which is awesome.


So I decided to start with the RGB one because it's simpler to get working. I plug it in and the green only strobes, then I run the code:



void setup() {               
  // initialize the LED pins as outputs
  pinMode(0, OUTPUT);     
  pinMode(1, OUTPUT);     
  pinMode(2, OUTPUT);     
}

void loop() {
  digitalWrite(0, HIGH);      // turn the Red LED On
  delay(100);              // wait for a second
  digitalWrite(1, HIGH);      // turn the Green LED On
  delay(10);              // wait for a second
  digitalWrite(2, HIGH);      // turn the Blue LED On
  delay(100);              // wait for a second
  digitalWrite(0, LOW);       // turn the Red LED off
  digitalWrite(1, LOW);     // turn the Green LED off
  digitalWrite(2, LOW);     // turn the Blue LED off
  delay(1000);              // wait for a second
}

And it only flashes green. I changed the pins to write 0 or 2 and it doesnt flash at all.

Bummer. Anyone know why it only shows green?

Thanks!

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Newb - Digi RGB help - Only Green outputs
« Reply #1 on: February 24, 2013, 08:35:26 pm »
You might want to look at your times.

You can turn all three ON at once, then have a single delay and turn them all OFF

Code: [Select]
void loop() {
  digitalWrite(0, HIGH);      // turn the Red LED On
  delay(100);              // wait for a second              ******this is 100mS
  digitalWrite(1, HIGH);      // turn the Green LED On
  delay(10);              // wait for a second               ******this is 10mS
  digitalWrite(2, HIGH);      // turn the Blue LED On
  delay(100);              // wait for a second              ******this is 100mS
  digitalWrite(0, LOW);       // turn the Red LED off
  digitalWrite(1, LOW);     // turn the Green LED off
  digitalWrite(2, LOW);     // turn the Blue LED off
  delay(1000);              // wait for a second             ******this is 1sec
}


To turn each on in turn try  ..(*** untested ***)

Code: [Select]

void setup()
{               
  // initialize the LED pins as outputs
  pinMode(0, OUTPUT);     
  pinMode(1, OUTPUT);     
  pinMode(2, OUTPUT); 
   
}
void loop()
{
  digitalWrite(0, HIGH);      // turn the Red LED ON
  delay(2000);                // wait 2 seconds 
  digitalWrite(0, LOW);      // turn the Red LED OFF
  delay(1000);


  digitalWrite(1, HIGH);      // turn the Green LED ON
  delay(2000);                // wait 2 seconds 
  digitalWrite(1, LOW);      // turn the Green LED OFF
  delay(1000);


  digitalWrite(2, HIGH);      // turn the Blue LED ON
  delay(2000);                // wait 2 seconds 
  digitalWrite(2, LOW);      // turn the Blue LED OFF
  delay(1000);
}




mark

UncleTony

  • Newbie
  • *
  • Posts: 15
Re: Newb - Digi RGB help - Only Green outputs
« Reply #2 on: February 26, 2013, 08:06:30 am »
Thank you for adding this, again, only the green LED is lighting up. I'm wondering if I did something wrong when wiring... hmm

UncleTony

  • Newbie
  • *
  • Posts: 15
Re: Newb - Digi RGB help - Only Green outputs
« Reply #3 on: February 26, 2013, 08:27:39 am »
wow so weird, i went back thru with my soldering iron and i must suck at soldering. cause I just cleaned up some lines and now blue works... !... kinda weird since I'm still missing the third color, but Im wondering which pin isn't perfect now that only green and blue work. hah this is weird

UncleTony

  • Newbie
  • *
  • Posts: 15
Re: Newb - Digi RGB help - Only Green outputs
« Reply #4 on: February 26, 2013, 08:37:39 am »
SOLVED: re soldered my P0-P2 and to my surprise it works!


Thanks for helping me out with this, I can finally start messing with code.


Thanks everybody


#closed