Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Rotary controls LED
- int rotaryPin = A0; // select the input pin for the rotary
- int ledPin = 4; // select the pin for the LED
- int rotaryValue = 0; // variable to store the value coming from the rotary
- void setup() {
- // declare the ledPin as an OUTPUT:
- pinMode(ledPin, OUTPUT);
- pinMode(rotaryPin, INPUT);
- }
- void loop() {
- // read the value from the sensor:
- rotaryValue = analogRead(rotaryPin);
- // turn the ledPin on
- digitalWrite(ledPin, HIGH);
- // stop the program for <sensorValue> milliseconds:
- delay(rotaryValue);
- // turn the ledPin off:
- digitalWrite(ledPin, LOW);
- // stop the program for for <sensorValue> milliseconds:
- delay(rotaryValue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement