Guest User

Untitled

a guest
Sep 26th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. /*
  2. AnalogReadSerial
  3. Reads an analog input on pin 0, prints the result to the serial monitor.
  4. Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
  5.  
  6. This example code is in the public domain.
  7. */
  8.  
  9.  
  10. int ligado = 0; // maximum sensor value
  11.  
  12.  
  13. // the setup routine runs once when you press reset:
  14. void setup() {
  15. // initialize serial communication at 9600 bits per second:
  16. Serial.begin(9600);
  17. }
  18.  
  19. // the loop routine runs over and over again forever:
  20. void loop() {
  21. // read the input on analog pin 0:
  22. int sensorValue = analogRead(A0);
  23.  
  24. while (sensorValue == ligado) {
  25. Serial.println("ligado");
  26. break;
  27. }
  28.  
  29. // print out the value you read:
  30.  
  31. delay(1); // delay in between reads for stability
  32. }
Add Comment
Please, Sign In to add comment