Guest User

Untitled

a guest
Apr 25th, 2013
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 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. // the setup routine runs once when you press reset:
  10. void setup() {
  11.   // initialize serial communication at 9600 bits per second:
  12.   Serial.begin(9600);
  13. }
  14.  
  15. // the loop routine runs over and over again forever:
  16. void loop() {
  17.   // read the input on analog pin 0:
  18.   int sensorValue = analogRead(A0);
  19.   // print out the value you read:
  20.   Serial.println(sensorValue);
  21.   delay(1);        // delay in between reads for stability
  22. }
Add Comment
Please, Sign In to add comment