int potPin = 2; // select the input pin for analog input
int val = 0; // variable to store the value coming from the sensor
void setup()
{
Serial.begin( 9600 ); // set the serial communication rate
}
void loop()
{
val = analogRead( potPin ); // read the value from the sensor
Serial.print( val ); // print the value
Serial.println(); // print a linefeed character
delay( 500 ); // delay 500 milliseconds
}
|
| ©2004-2026 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |