Analog Signal Input Application
Analog Signal Input Application

Analog Signal Input Application

As it is known, Arduino UNO has 6 analog input pins. These are pins A0, A1, A2, A3, A4 and A5. Analog signals between 0 (zero) and 5 (five) volts can be input to these analog inputs.
Analog signals can be the sound level, the value from the temperature sensor, or the value from the humidity sensor. We will input with the help of potentiometer in this application.
We will connect the middle pin of the potentiometer to the A0 analog input pin of the Arduino UNO. We will change the input voltage. We will see the change with the help of the leds we connect to the digital pins.

Codes:

void setup() {
// Red leds -------------------
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  //blue leds----------------------
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);  //green led<------------
  pinMode(6, OUTPUT);  //yellow led   <-----------
}
 
void loop() {
 
int pot_in = analogRead(A0);// POT INPUT
int input_level = map(pot_in, 0, 1023, 1, 8); // CONVERT 1--->8
 
for(int i=1;i<=input_level;i++)  {
    digitalWrite(i+5,HIGH); delay(1);digitalWrite(i+5,LOW);
    }}

Youtube Channel: