Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define red 2
- #define yellow 3
- #define green 4
- #define POT_PIN A0
- void setup()
- {
- pinMode(red, OUTPUT);
- pinMode(yellow, OUTPUT);
- pinMode(green, OUTPUT);
- pinMode(POT_PIN, INPUT);
- }
- void loop()
- {
- int rotation, k;
- rotation = analogRead(POT_PIN);
- k = rotation/100;
- digitalWrite(red, HIGH);
- delay(1000+100*k);
- digitalWrite(yellow, HIGH);
- delay(250+100*k);
- digitalWrite(yellow, LOW);
- digitalWrite(red, LOW);
- digitalWrite(green, HIGH);
- delay(1250+100*k);
- digitalWrite(green, LOW);
- digitalWrite(yellow, HIGH);
- delay(500+100*k);
- digitalWrite(yellow, LOW);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement