Stap 3: CODE
int r = 11;
int g = 10;
int b = 9;
int pv = 0;
int yv = 0;
VOID Setup {}
pinMode (r, OUTPUT);
pinMode (g, OUTPUT);
pinMode (b, OUTPUT);
}
void loop {}
voor (int rv = 1; rv < 204; rv ++) {}
analogWrite(r,rv);
delay(10);
}
voor (int rv = 255; rv > 1; rv--) {}
analogWrite(r,rv);
delay(10);
}
voor (int gv = 1; gv < 204; gv ++) {}
analogWrite(g,gv);
delay(10);
}
voor (int gv = 255; gv > 1; gv--) {}
analogWrite(g,gv);
delay(10);
}
voor (int bv = 1; bv < 204; bv ++) {}
analogWrite(b,bv);
delay(10);
}
voor (int bv = 255; bv > 1; bv--) {}
analogWrite(b,bv);
delay(10);
}
while(PV<204) {}
analogWrite(r,pv);
analogWrite(b,pv);
delay(10);
PV ++;
}
while(PV>1) {}
analogWrite(r,pv);
analogWrite(b,pv);
delay(10);
PV--;
}
while(yv<204) {}
analogWrite(r,yv);
analogWrite(g,yv);
delay(10);
yv ++;
}
while(yv>1) {}
analogWrite(r,yv);
analogWrite(g,yv);
delay(10);
yv--;
}
}