Hi guys i was wondering if there was a way to make this code i have fade through the colors slower... please help Thanks
// attiny85 RGB led rainbow fade
const int redPin = 3;
const int grnPin = 4;
const int bluPin = 1;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop()
{
redtoyellow();
yellowtogreen();
greentocyan();
cyantoblue();
bluetomajenta();
majenatored();
}
void redtoyellow()
{
digitalWrite(redPin, HIGH);
digitalWrite(bluPin, LOW);
// fade up green
for(byte i=1; i<100; i++) {
byte on = i;
byte off = 100-on;
for( byte a=0; a<100; a++ ) {
digitalWrite(grnPin, HIGH);
delayMicroseconds(on);
digitalWrite(grnPin, LOW);
delayMicroseconds(off);
}
}
}
void yellowtogreen()
{
digitalWrite(grnPin, HIGH);
digitalWrite(bluPin, LOW);
// fade down red
for(byte i=1; i<100; i++) {
byte on = 100-i;
byte off = i;
for( byte a=0; a<100; a++ ) {
digitalWrite(redPin, HIGH);
delayMicroseconds(on);
digitalWrite(redPin, LOW);
delayMicroseconds(off);
}
}
}
void greentocyan()
{
digitalWrite(grnPin, HIGH);
digitalWrite(redPin, LOW);
// fade up blue
for(byte i=1; i<100; i++) {
byte on = i;
byte off = 100-on;
for( byte a=0; a<100; a++ ) {
digitalWrite(bluPin, HIGH);
delayMicroseconds(on);
digitalWrite(bluPin, LOW);
delayMicroseconds(off);
}
}
}
void cyantoblue()
{
digitalWrite(bluPin, HIGH);
digitalWrite(redPin, LOW);
// fade down green
for(byte i=1; i<100; i++) {
byte on = 100-i;
byte off = i;
for( byte a=0; a<100; a++ ) {
digitalWrite(grnPin, HIGH);
delayMicroseconds(on);
digitalWrite(grnPin, LOW);
delayMicroseconds(off);
}
}
}
void bluetomajenta()
{
digitalWrite(bluPin, HIGH);
digitalWrite(grnPin, LOW);
// fade up red
for(byte i=1; i<100; i++) {
byte on = i;
byte off = 100-on;
for( byte a=0; a<100; a++ ) {
digitalWrite(redPin, HIGH);
delayMicroseconds(on);
digitalWrite(redPin, LOW);
delayMicroseconds(off);
}
}
}
void majenatored()
{
digitalWrite(redPin, HIGH);
digitalWrite(grnPin, LOW);
// fade down blue
for(byte i=1; i<100; i++) {
byte on = 100-i;
byte off = i;
for( byte a=0; a<100; a++ ) {
digitalWrite(bluPin, HIGH);
delayMicroseconds(on);
digitalWrite(bluPin, LOW);
delayMicroseconds(off);
}
}
}