Youtube video

Things you need

Arduino UNO


Breadboard wires




so first we need 2 integer to save the sensor value and the timer

after that in “void setup()” we set the pins 12 and 11 as output for our LEDs

then in “void loop()”

we first save the value of pin A0 in sensorValue integer with help of ADC, and we use map to remap the value

at last, we turn on and off the LEDs with a  delay which the timer of the delay is our value

How to connect

What is ADC

An Analog to Digital Converter (ADC) is a very useful feature that converts an analog voltage on a pin to a digital number (most of the time 5V = 1023) .

What is map()

Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc.

Note that the “lower bounds” of either range may be larger or smaller than the “upper bounds” so the map() function may be used to reverse a range of numbers, for example

y = map(x, 1, 50, 50, 1);

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments