Example project · Microcontrollers
LED bargraph (pot level meter)
A VU-meter on the bench: the ATmega328P reads the trim pot with its real 10-bit ADC and lights a six-LED bar on D8-D13, green through red, one LED per ~160 counts. Click the pot and drag its Position slider in the Inspector to sweep the bar up and down; the raw reading prints over serial. The Code tab holds the same meter as an editable Arduino sketch.

What's on the bench
- 6× LED
- 6× Resistor
- Arduino Uno
- Battery
- Trim Pot
The code
This Arduino C++ sketch lives in the Code tab; sign in and press Compile & upload to build real firmware for the emulated board.
// The same level meter as an Arduino sketch. Edit it, then Compile & // upload (sign-in needed): the server builds real AVR firmware. const int POT = A0; const int LEDS[6] = {8, 9, 10, 11, 12, 13}; // green -> red void setup() { for (int i = 0; i < 6; i++) pinMode(LEDS[i], OUTPUT); Serial.begin(9600); } void loop() { int v = analogRead(POT); // 0..1023 from the real ADC int level = min(6, v / 160); // one LED per ~160 counts for (int i = 0; i < 6; i++) digitalWrite(LEDS[i], i < level); Serial.print("A0 "); Serial.println(v); delay(200); }