hey there! i made this code for 4 rgb and 1 led on arduino uno and need code to turn the led/rgb led dimming! like it will trun on within a second but it will take time to off!
int led = 13;
int ledDigitalOne[] = {14, 15, 16};
int ledDigitalTwo[] = {9, 10, 11};
int ledDigitalThree[] = {3, 5, 6};
int ledDigitalFour[] = {0, 1, 2};
const boolean ON = LOW;
const boolean OFF = HIGH;
const boolean RED[] = {ON, OFF, OFF};
const boolean GREEN[] = {OFF, ON, OFF};
const boolean BLUE[] = {OFF, OFF, ON};
const boolean YELLOW[] = {ON, ON, OFF};
const boolean CYAN[] = {OFF, ON, ON};
const boolean MAGENTA[] = {ON, OFF, ON};
const boolean WHITE[] = {ON, ON, ON};
const boolean BLACK[] = {OFF, OFF, OFF};
const boolean* COLORS[] = {RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, WHITE, BLACK};
void setup(){
for(int i = 0; i < 3; i++) {
 pinMode(led, OUTPUT);
Â
 pinMode(ledDigitalOne[i], OUTPUT);
 pinMode(ledDigitalTwo[i], OUTPUT);
 pinMode(ledDigitalThree[i], OUTPUT);
 pinMode(ledDigitalFour[i], OUTPUT);
}
}
void loop(){
digitalWrite(led, HIGH);
delay(150);
digitalWrite(led, LOW);
delay(580);
/* Example - 1 Set a color Set the three LEDs to any predefined color*/
setColor(ledDigitalOne, RED);
setColor(ledDigitalTwo, GREEN);
setColor(ledDigitalThree, BLUE);
setColor(ledDigitalFour, RED);
/* Exampe - 2 Go through Random Colors Set the LEDs to a random color*/
int rand = random(0, sizeof(COLORS) / 2);
setColor(ledDigitalOne, COLORS[rand]);
rand = random(0, sizeof(COLORS) / 2);
setColor(ledDigitalTwo, COLORS[rand]);
rand = random(0, sizeof(COLORS) / 2);
setColor(ledDigitalThree, COLORS[rand]);
setColor(ledDigitalFour, COLORS[rand]);
delay(1000);
}
/* Sets an led to any color led - a three element array defining the three color pins (led[0] = redPin, led[1] = greenPin, led[2] = bluePin) color - a three element boolean array (color[0] = red value (LOW = on, HIGH = off), color[1] = green value, color[2] =blue value)*/
void setColor(int* led, boolean* color){
for(int i = 0; i < 3; i++) {
digitalWrite(led[i], color[i]);
}
}
/* A version of setColor that allows for using const boolean colors*/
void setColor(int* led, const boolean* color) {
boolean tempColor[] = {color[0], color[1], color[2], color[3]};
setColor(led, tempColor);
}
HELP!
THANK YOU