This example shows you how to read an analog input at analog pin 0, convert the values from analogRead() into voltage, and print it out to the serial monitor of the Arduino Software (IDE).
You will need the following components −
Follow the circuit diagram and hook up the components on the breadboard as shown in the image given below.
Open the Arduino IDE software on your computer. Coding in the Arduino language will control your circuit. Open a new sketch File by clicking New.
These 10-segment bar graph LEDs have many uses. With a compact footprint, simple hookup, they are easy for prototype or finished products. Essentially, they are 10 individual blue LEDs housed together, each with an individual anode and cathode connection.
They are also available in yellow, red, and green colors.
Note − The pin out on these bar graphs may vary from what is listed on the datasheet. Rotating the device 180 degrees will correct the change, making pin 11 the first pin in line.
The sketch works like this: first, you read the input. You map the input value to the output range, in this case ten LEDs. Then you set up a for-loop to iterate over the outputs. If the output's number in the series is lower than the mapped input range, you turn it on. If not, you turn it off.
You will see the LED turn ON one by one when the value of analog reading increases and turn OFF one by one while the reading is decreasing.
Arduino Related Interview Questions
|IBM-REXX Interview Questions||Flash Interview Questions|
|Computer Hardware Interview Questions||Software Engineering Interview Questions|
|PLC/Microcontrollers/Microprocessors Interview Questions||IBM Integration Bus Interview Questions|
|Continuous Integration Interview Questions||C preprocessor Interview Questions|
|8051 Microcontroller Interview Questions||TCS Technical Interview Questions|
|Wipro Technical Interview Questions||Wipro Java Interview Questions|
|Fieldbus Interview Questions||Universe Designer Interview Questions|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.