Things used in this project

Hardware components:
09590 01
LED (generic)
×10
A000066 iso both
Arduino Arduino UNO & Genuino UNO
×1
Mfr 25fbf52 221r sml
Resistor 221 ohm
×10
11026 02
Jumper wires (generic)
×13
09939 01
Rotary potentiometer (generic)
×1
Software apps and online services:
Ide web
Arduino Arduino IDE

Schematics

Bar Graph
Bargraph bb mfhm8kyoal

Code

GraphC/C++
const int analogPin = A0;   // the pin that the potentiometer is attached to
const int ledCount = 10;    // the number of LEDs in the bar graph

int ledPins[] = {
  2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};   // an array of pin numbers to which LEDs are attached


void setup() {
  // loop over the pin array and set them all to output:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    pinMode(ledPins[thisLed], OUTPUT);
  }
}

void loop() {
  // read the potentiometer:
  int sensorReading = analogRead(analogPin);
  // map the result to a range from 0 to the number of LEDs:
  int ledLevel = map(sensorReading, 0, 1023, 0, ledCount);

  // loop over the LED array:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    // if the array element's index is less than ledLevel,
    // turn the pin for this element on:
    if (thisLed < ledLevel) {
      digitalWrite(ledPins[thisLed], HIGH);
    }
    // turn off all pins higher than the ledLevel:
    else {
      digitalWrite(ledPins[thisLed], LOW);
    }
  }
}

Credits

Arduino icon 2 oz4hdh5f0y
Tudose Matei

I'm a beginner and I love Arduino ! I discovered hardware and software at academy "inventeaza.ro" . This academy is brilliant !

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Distance Indicator Using Ultrasonic Sensor
Easy
  • 108
  • 4

Work in progress

This project lights a set of LED's depending upon the distance of the obstacle with respect to the ultrasonic sensor.

Arduino - Web-Based Joystick
Easy
  • 272
  • 8

Full instructions

This project shows how to control devices from anywhere using web-based joystick on smartphone.

BluSpike - Community Driven BLE Sensor Network
Easy
  • 89
  • 2

Full instructions

Easy to build w/ off the shelf parts, BLE solar powered sensor array. Connect and share its data to the cloud and be rewarded with ethereum

Arduino - Have Fun with Color Sensor
Easy
  • 1,110
  • 16

Full instructions

This project shows how to change color of Minion using Arduino, PHPoC WiFi Shield and color sensor.

Using Python and Arduino MKR1000 for Secure IoT
Easy
  • 3,385
  • 15

Full instructions

Getting started with Python and Arduino MKR1000 for secure IoT projects.

Electronic Voting Machine Using Arduino
Easy
  • 243
  • 5

It is an EVM using Arduino. There are five switches in all, assigned for various activities.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login