Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sensorPin = A0;
- int ledPin = 13;
- int sensorValue = 0;
- void setup() {
- pinMode(ledPin, OUTPUT);
- }
- void loop() {
- // read the value from the sensor:
- sensorValue = analogRead(sensorPin);
- // turn the ledPin on
- digitalWrite(ledPin, HIGH);
- // stop the program for <sensorValue> milliseconds:
- delay(sensorValue);
- // turn the ledPin off:
- digitalWrite(ledPin, LOW);
- // stop the program for for <sensorValue> milliseconds:
- delay(sensorValue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement