Read the ThinkerShield's potentiometer (A5) with analogRead, use the value to set the LED's blink rate, and print it to the Serial Monitor.
From the unit Crack the Code
· activity PRP 3: Analog input — potentiometer & LDR
int sensorPin = A5; // the potentiometer (POT A5) on the ThinkerShield
int ledPin = 12; // the LED on pin D12
int sensorValue = 0; // variable to store the value from the sensor
void setup() {
pinMode(ledPin, OUTPUT); // the LED pin is an output
Serial.begin(9600); // start serial so we can print the sensor value
}
void loop() {
sensorValue = analogRead(sensorPin); // read the knob (0 to 1023)
digitalWrite(ledPin, HIGH); // LED on
delay(sensorValue); // wait — bigger value, longer wait
digitalWrite(ledPin, LOW); // LED off
delay(sensorValue); // wait again
Serial.print("The sensor value is: ");
Serial.println(sensorValue); // print the value to the Serial Monitor
}
Shared from Little Bird Electronics curriculum.