Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. int sensorPin = 0; // select the input pin for the potentiometer
  2. int sensorValue = 0; // variable to store the value coming from the sensor
  3.  
  4. int sensorVCC = 13;
  5.  
  6. void setup() {
  7. // declare the ledPin as an OUTPUT:
  8. Serial.begin(9600);
  9. pinMode(sensorVCC, OUTPUT);
  10. digitalWrite(sensorVCC, LOW);
  11. }
  12.  
  13. void loop() {
  14. // power the sensor
  15. digitalWrite(sensorVCC, HIGH);
  16. delay(100); //make sure the sensor is powered
  17. // read the value from the sensor:
  18. sensorValue = analogRead(sensorPin);
  19. //stop power
  20. digitalWrite(sensorVCC, LOW);
  21. //wait
  22. delay(60*1000);
  23. Serial.print("sensor = " );
  24. Serial.println(sensorValue);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement