Go Down

Topic: Brainbox arduino leonardo not working with RGB led (Read 199 times) previous topic - next topic

Plushy

Fellow coders,

I have to make an RGB led blink in different colors for a school project. Which may sound like an easy task, but we got a modified arduino called the 'arduino brainbox'. The code that I wrote works on tinkercad. But when I try to upload the same code (that I posted below) to the arduino leonardo it doesn't work. The code gets uploaded but that's it no RGB led blinking around, just nothing.
I attached some pictures below aswel if there might be a problem with my circuiting. Can't seem to find the problem. And google doesn't seem to help either. (The pictures are attached in the files below)




Code: [Select]
int redPin= 5;
int greenPin = 6;
int bluePin = 9;
void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}
void loop() {
  setColor(255, 0, 0); // Red Color
  delay(1000);
  setColor(0, 255, 0); // Green Color
  delay(1000);
  setColor(0, 0, 255); // Blue Color
  delay(1000);
  setColor(255, 255, 255); // White Color
  delay(1000);
  setColor(170, 0, 255); // Purple Color
  delay(1000);
}
void setColor(int redValue, int greenValue, int blueValue) {
  analogWrite(redPin, redValue);
  analogWrite(greenPin, greenValue);
  analogWrite(bluePin, blueValue);
}

Go Up