Advertisement
ambersy314

Untitled

Jun 29th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. int sensorPin = A0;
  3. int ledPin = 13;
  4. int sensorValue = 0;
  5.  
  6. void setup() {
  7.  
  8. pinMode(ledPin, OUTPUT);
  9. }
  10.  
  11. void loop() {
  12. // read the value from the sensor:
  13. sensorValue = analogRead(sensorPin);
  14. // turn the ledPin on
  15. digitalWrite(ledPin, HIGH);
  16. // stop the program for <sensorValue> milliseconds:
  17. delay(sensorValue);
  18. // turn the ledPin off:
  19. digitalWrite(ledPin, LOW);
  20. // stop the program for for <sensorValue> milliseconds:
  21. delay(sensorValue);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement