Thursday, January 17, 2013

Microcontrollers!

Today, I get familiar with the soon-to-be brain of my hacked robots. I will program this MSP430 microcontroller to output or input whatever I want!
The next task was to use one pin on the controller for input, and one for output. The input pin registers "on" when I close its circuit with a push button, and the output pin lights up an LED.

I give you a brief look at my code here too, but I won't really go into that.

Then I ran a program that lights up multiple LEDs in sequence. My code designates the timing and order that they light up in.
The program's "setup" method begins the program with one light pulsing on and off at an increasing rate, then the main "loop" method runs several LED pulsing commands in sequence to create a scrolling effect like the car KITT from Nightrider.
I reset the program with the reset button on the controller. 

Also, there's close up of the microcontroller.

Last was to use the Light Dependent Resistor (LDR) as analog input for the controller, and use that input to output 4 different states, as indicated by the LED pattern. I just cover the LDR with my fingers to vary its input.

Full ambient light - both light
high-medium light - LED1 lights
low-medium light - LED2 lights
low ambient light - none light

No comments:

Post a Comment