
I used an example from Arduino.cc to practice receiving analog signals through the analog inputs. In this example, the wait time between the blinks of the embedded LED are going to be sent to the Arduino UNO board from the potentiometer. The potentiometer sends voltage to the analog input, which in turn converts it to a numerical value from 0 to 1023, depending on the amount of voltage. These possible values are easy to use when it comes to the amount of time the LED should be on, which is measured in milliseconds. Below are the components used in this example:
- Arduino UNO Board
- Potentiometer
Schematics

Code
I started the code by introducing all of the variables and setting up the output of the LED.
int sensorPin = A0; // potentiometer pin
int ledPin = 13;
int sensorValue = 0;
void setup() {
pinMode(ledPin, OUTPUT);
}
Next is the main loop. Here I take the value from the sensor, and turn on the LED with the given intervals as you can see on lines 5 – 8.
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}