hlxldb

LED光立方制作全过程(二十四)

0
阅读(31481)

 

Step 40Build the controller: Buttons and status LEDs

Build the controller: Buttons and status LEDs
loading...
i
Build the controller: Buttons and status LEDs
Build the controller: Buttons and status LEDs
You can make a LED cube without any buttons at all, but it's nice to have at least one button and some status LEDs for debugging.

We added one awesome looking button with two built in LEDs, and one regular button with an LED.

The first button is mounted on the latch array PCB, since this will sit on top of the AVR board, and we want the button easily accessible. The wires are routed through the ribbon cable. The second button and LED sits on the AVR board and was mostly used for debugging during construction.

The buttons are connected between GND and the IO pin on the ATmega. An internal pull-up resistor inside the ATmega is used to pull the pin high when the button is not pressed. When the button is pressed, the IO pin is pulled low. A logic 0 indicates that a button has been pressed.

The LEDs are also connected between GND and the IO pin via a resistor of appropriate size. Don't connect an LED to a micro controller IO pin without having a resistor connected in series. The resistor is there to limit the current, and skipping it can blow the IO port on your micro controller.

To find the appropriate resistor, just plug the led into a breadboard and test different resistors with a 5v power supply. Choose the resistors that make the LED light up with the brightness you want. If you use LEDs with different colors, you should test them side by side. Different color LEDs usually require different resistors to reach the same level of brightness.

We will leave it up to you to decide the placement of your status LEDs, but you can see in the pictures below how we did it: