RGB Lesson three help needed

For makers who have purchased an Adafruit Starter Pack, get help with the tutorials here!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Jmckeon
 
Posts: 5
Joined: Fri Apr 25, 2014 7:08 pm

RGB Lesson three help needed

Post by Jmckeon »

OK, so working on lesson 3, don't have 270ohm resistors so using 330ohm otherwise it's all as prescribed.

Tried it with a small breadboard just like in the examples on the lesson... nothing, not eve a blip...

so tried it also using the protoshield (which has worked with other projects fine) and still nothing..

tried 100ohm resistors.. nope, tried a different full color LED, nope.. tried different wires... nope...

now I'm completely lost.. I have no idea why this isn't working.

Pictures of the current setup attached. I'm a total noob at electronics so I don't even know where to start troubleshooting this... (which, ironically is why I'm doing this..)

thanks for any guidance you can give...
Attachments
photo 1.JPG
photo 1.JPG (130.13 KiB) Viewed 1758 times
photo 2.JPG
photo 2.JPG (103.52 KiB) Viewed 1758 times

Jmckeon
 
Posts: 5
Joined: Fri Apr 25, 2014 7:08 pm

Re: RGB Lesson three help needed

Post by Jmckeon »

Ok,

So did some digging and gained enough knowledge to set my shiny new multimeter to a continuity test. I tested all of the LED's, the wires and resistors... even tested them running them threw the bread board.. the LED does lite up when the multimeter is connected SO it must be either the Arduino board OR the Sketch...

Here's the sketch...

I tried with both commenting out and un-commenting the Common Annode..

Even tried (as you see below) changing to pins 3, 5 & 6

So if the below sketch looks correct, I guess it's the board? how can I test the specific pins on the board with my multimeter?

/*
Adafruit Arduino - Lesson 3. RGB LED
*/

int redPin = 6;
int greenPin = 5;
int bluePin = 3;

//uncomment this line if using a Common Anode LED
//#define COMMON_ANODE

void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop()
{
setColor(255, 0, 0); // red
delay(1000);
setColor(0, 255, 0); // green
delay(1000);
setColor(0, 0, 255); // blue
delay(1000);
setColor(255, 255, 0); // yellow
delay(1000);
setColor(80, 0, 80); // purple
delay(1000);
setColor(0, 255, 255); // aqua
delay(1000);
}

void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
#endif
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

Jmckeon
 
Posts: 5
Joined: Fri Apr 25, 2014 7:08 pm

Re: RGB Lesson three help needed

Post by Jmckeon »

Ok, took a step back, and just went with the basics.....

I know the full color LED works because I tested it with the multimeter.

so I put the protoshield on the arduino, hooked up a simple 100ohm resistor and red LED to the ground and 5v... it lights up. then replace the red LED with the Full color LED being careful to make sure the negative lead is attached to ground and nothing...... see attached pics..

there is something fundamentally basic that I just don't understand about this LED I'm sure....
Attachments
photo 2(1).JPG
photo 2(1).JPG (144.79 KiB) Viewed 1753 times
photo 1(1).JPG
photo 1(1).JPG (120.54 KiB) Viewed 1753 times

Jmckeon
 
Posts: 5
Joined: Fri Apr 25, 2014 7:08 pm

Re: RGB Lesson three help needed

Post by Jmckeon »

and then it came to me... reverse the ground and votage input and the LED lit up....

Jmckeon
 
Posts: 5
Joined: Fri Apr 25, 2014 7:08 pm

Re: RGB Lesson three help needed

Post by Jmckeon »

So am I nuts or are my full color LED's reversed? that is they have a common anode and 3 separate cathodes? The only way I get them to light up is to have a common positive and connect the 3 individual leads (shorter ones) to ground.

anyone??

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: RGB Lesson three help needed

Post by adafruit_support_mike »

RGB LEDs exist in both common-anode and common-cathode forms. It just depends on how they wired the connections inside the envelope.

You did a great job of troubleshooting though.. measure, test, compare with another known circuit, try something completely off the wall, then try to figure out why that worked. That's pretty much how the circuit design process works. ;-)

Since your exploration process was so good, and you managed to solve the functional problem before any of us were able to post a reply, I'm awarding you an LED skill badge: https://www.adafruit.com/products/479

Send a note to [email protected] with a link to this thread and the folks there will get it to you.

henryz
 
Posts: 1
Joined: Tue May 20, 2014 5:17 pm

Re: RGB Lesson three help needed

Post by henryz »

I just started learning the starter pack and woriking on lesson 3. I copied all the code of the RGB to the sketch, but can not upload it to the board. Whenever try to upload, the compling will fail with the following error:
in 'void loop()':
error: 'setColor' was not declared in this scope

please help

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: RGB Lesson three help needed

Post by adafruit_support_bill »

@henryz - make sure you copy the whole sketch. SetColor is part of it:

Code: Select all

/*
Adafruit Arduino - Lesson 3. RGB LED
*/

int redPin = 11;
int greenPin = 10;
int bluePin = 9;

//uncomment this line if using a Common Anode LED
//#define COMMON_ANODE

void setup()
{
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);  
}

void loop()
{
  setColor(255, 0, 0);  // red
  delay(1000);
  setColor(0, 255, 0);  // green
  delay(1000);
  setColor(0, 0, 255);  // blue
  delay(1000);
  setColor(255, 255, 0);  // yellow
  delay(1000);  
  setColor(80, 0, 80);  // purple
  delay(1000);
  setColor(0, 255, 255);  // aqua
  delay(1000);
}

void setColor(int red, int green, int blue)
{
  #ifdef COMMON_ANODE
    red = 255 - red;
    green = 255 - green;
    blue = 255 - blue;
  #endif
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);  
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Starter Pack”