Arduino Mega — 10-LED Bar Graph
Light up an LED "bar" that grows with the analog input
Arduino
Mega
LED
for-loop
Bar graph
What you will learn
- How to drive many LEDs from a single for-loop and an array of pin numbers
- The map() function to convert analogRead (0-1023) to LED count (0-10)
- Why a bar graph is more intuitive than a single blinking LED
What you will need
| Component |
|---|
| 1× Arduino Mega 2560 |
| 10× LED (any color) |
| 10× 220Ω resistor |
| 1× potentiometer |
| 1× breadboard |
| 12× jumper wires |
Step by step
Take it further
- Use a temperature sensor instead of the pot and label the bar with temperature zones (cool/warm/hot).
- Add a button to switch between "VU meter" and "Knight Rider" (one LED sweeping back and forth).
- Replace the 10 LEDs with one RGB LED that changes color from green to yellow to red as the value rises.
Practise it before you build it
Wire this circuit in the ThinkEdge Learn simulator first. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so the LED on screen actually lights when the current is right — no hardware, no burnt components, and a class can try it in a browser.
Related projects
Arduino — Two-Player Reaction BattleTwo players, two buttons — fastest finger wins
Arduino Mega — Traffic Light ControllerA full intersection with pedestrian crossing — and a buzzer
Arduino — Servo SweepMake a servo motor wave back and forth
Arduino Nano — Reaction Timer GameHow fast can you press the button? Built in a tiny form factor.
Arduino Nano — 4-Note Mini PianoFour buttons, four notes, one tiny piano that fits in your pocket
Arduino Nano — Parking Sensor4 distance zones — 1 slow low beep far, 2 fast high-pitch beeps close (like a real car reversing buzzer)
Guides that use this project
21 guides on the site build this project as part of a longer explanation. The guide says why the circuit works; this page says how to wire it.
How to Make a Drone for a School ProjectHow to make a drone for a school project: a classroom-safe, low-cost build with no LiPo or radio gear, and the measurements to present it with.
Smart Lighting: The Driver, the Controller and the RadioSmart lighting is a driver, a controller and a radio. Learn PWM, current limits, MOSFET switching and flicker, then build a lamp you can query.
3D Printing for StudentsHow a 3D printer works, which type to start with, and how to design your own models, with the electronics behind extrusion and stepper control explained.
3D Print Files and STLsWhere to find 3D print files, what an STL file actually is, how to check one before you print, and how to design your own from scratch.
3D Printed Toys and ModelsWhich 3D printed toys make good classroom projects: designs with tolerances and moving parts, and the assembly and mechanism skills they teach.
Metal 3D PrintingMetal 3D printing explained: powder bed fusion against wire arc, what each process is good for, why metal prints need support and heat treatment, and what it costs.
What an AI Agent Actually IsAn AI agent is a loop of model calls, tools and memory. Learn how that loop maps onto the sense, decide, act cycle of a robot you can build this term.
Edge AI: Decisions Made on the DeviceEdge AI runs the decision on the device instead of in the cloud. Here is what that buys you in latency and privacy, and what a 32 KB microcontroller can really do.
Physical AI: Intelligence That Has to ActPhysical AI is intelligence that drives a motor, not a cursor. Here is how models, controllers and feedback split up, and how to build the loop safely.
AI Swarm: Many Small Robots, Three RulesA swarm is not a clever algorithm, it is three local rules. Learn separation, alignment and cohesion, then build them as if-statements on an Arduino.
Local LLM: Your Own Model, Your Own MachineRun a language model on your own hardware: the RAM maths for a Raspberry Pi, the real token speeds, and how an Arduino can act on what the model says.
Self-Improving AI: Three Different ClaimsSelf-improving AI means three different things. Separate them, then build the version you can measure: a controller that tunes itself and shows you the numbers.
DGX Spark: What the Hardware Actually IsDGX Spark packs a 20-core Arm CPU and a Blackwell GPU into 128 GB of shared memory. Here is what it buys you, what it costs, and where it does not help.
RTX 5080: The Card, the Numbers, the CaveatRTX 5080 specs and price: 16 GB of GDDR7, 360 W of board power and a $999 launch price that no longer matches the street. Here is who should buy one.
Artificial Intelligence for StudentsArtificial intelligence for students: what a model really is, the three ways to learn it that are not hype, and the projects that prove each one landed.
AGI: Artificial General Intelligence, PreciselyAGI means a system that can do any cognitive task a human can and transfer what it learns. It does not exist yet, and here is how you would know if it did.
Open Code and OpenCode: A Coding Agent You Can ReadOpen code is a loop: read, plan, edit, run, read the error, fix. Here is how opencode, an open source coding agent, fits into a school project and what it costs.
AI in the Classroom: What to Allow and What to StopAI in the classroom works when the policy is specific. Here is what AI genuinely helps with, the rules that keep it honest, and what a school should not upload.
Arduino IDE Download and SetupWhere to download the Arduino IDE safely, which version to pick, the board manager and library manager steps, and the three install problems almost everyone hits.
3D Printing in Steel3D printing in steel uses metal powder or wire, not plastic filament. The process involved, why it is expensive, and where a school project should use it.
Best 3D Printers for StudentsHow to choose a 3D printer for a classroom: FDM versus resin, enclosed or not, what a Snapmaker, P2S or Bambu Lab does for schools, and what to skip.
Where this project sits
It is also part of these lists, which is how a class usually finds it.
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.