int potPin = 2;
//connect one leg of the potentiometer to analog pin2
int val = 0;//
to store values in the variable "val"
void setup(){
Serial.begin(9600);
}
void loop(){
val = analogRead(potPin);
// to read the analog value from the potentiometer
Serial.write(val);
// to write the value to the processing
delay(100);
}
沒有留言:
張貼留言