Binary Counter

The goal of this project is to show numbers, in binary, on eight LEDS.

With 8 LEDs we can display the numbers in the range 0-255:

  • 0 => All LEDs off.
  • 255 => All LEDs on.

View of LEDs lit. View of LEDs lit.

Wiring

Wiring the project just involves choosing eight output pins, (I'd recommend 1-8), and on each one wiring:

  • PIN XX -> 220k Resister -> LED -> Ground.

Code

The code for this project doesn't show anything more complex than that in the official starter-kit - the difference is that rather than using a pin output to control a single LED we control eight of them.

Download the code.

Usage

Once you've loaded the code in your IDE, compiled & uploaded it your board will start counting from 0 to 255.

Because we're storing the number to display in a byte type once we reach 255 we'll reset to 0 (i.e. We can only store an eight-bit value in this type, and we overflow.)