int redPin = 9; // define the pin of the Red LED
int greenPin = 10;// define the pin of the Green LED
int bluePin = 11;// define the pin of the Blue LED
int rotationDialPin = A0;
void setup() {
pinMode(redPin, OUTPUT);//Will Turn LIght REd
pinMode(greenPin, OUTPUT);//Will Turn Light Green
pinMode(bluePin, OUTPUT);//Will Turn Light Blue
}
void loop() {
int rotationSpeed = map(analogRead(rotationDialPin), 0, 1023, 100, 1000);
setColor(255, 0, 0); // Red Colour Will be Shown.
delay(rotationSpeed);
setColor(0, 255, 0); // Green Colour Will be Shown.
delay(rotationSpeed);
setColor(0, 0, 255); // Blue Colour Will Be shown.
delay(rotationSpeed);
}
void setColor(int red, int green, int blue) {
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}