SparkFun Forums 

Where electronics enthusiasts find answers.

#196602
hi, i'm kimbo,
and i have commenced learning;
with reference to SIK Experiment Guide for Arduino - V3.3
Experiment 3: Driving an RGB LED

https://learn.sparkfun.com/tutorials/si ... an-rgb-led

my project gets the 8 colours ok -
but it doesn't do the rainbow gradient thing.

when i look at the code, in sketch(?), i can't understand if the rainbow gradient part is working or if it is something i need to paste into the section that is doing the 8 colours, replacing that section.

i wonder if perhaps the sketch(?) is not supposed to do both - 8 colors and rainbow gradient, but does one or the other.
i am embarrassed to ask this question - i suspect it is dumb:)
cheers,
Kim
User avatar
By darrellg
#196604
If you want to see the colors fade, you need to change
Code: Select all
void loop()
{
  mainColors();        // Red, Green, Blue, Yellow, Cyan, Purple, White
  //  showSpectrum();    // Gradual fade from Red to Green to Blue to Red
}
to
Code: Select all
void loop()
{
  mainColors();        // Red, Green, Blue, Yellow, Cyan, Purple, White
  showSpectrum();    // Gradual fade from Red to Green to Blue to Red
}
The two slashes before the call to showSpectrum() cause the compiler to skip that part. Two slashes indicate a comment, and everything after them to the end of the line is ignored.