Wednesday, May 6, 2009

myAVR board MK1 LPT

It's a microcontroller and I got one for computer science in school.
To be precise, we bought one of that for each one of our class.
Two days ago (Monday) we had our first lesson with that, and it was to simply test its functionality. We didn't test it completly though. But I know that all my ports (D, B, C), all LEDs, the buzzer and the two buttons work (and the processor, a Atmel Mega 8, works too of course).

The first program I made by myself is a ... err ... buzzer tone generator. It simply creates a static tone, getting quadratic lower on each pin down (6 pins all in all). The next addition are the two buttons to make even lower tones, so it's now 6*4 (=24) in total.

This is achieved by simply having a counter and putting its output to one of the ports. You have to know how numbers in the dual-number-system are working to understand that. Basically the first digit changes every clock, the second every two clocks, the third every fourth and so on.
The buttons simply add a predefined delay.
The bigger the pause between the signals, which are sent out to the port where you connect the buzzer to, the lower the tone will be.

I'd post my program here, but I doubt that anyone reading this blog would be interested in it or have any use for it.

Next I'm trying to make a little crappy game, where you have to press a button fast enough.

Done, took me about 2 damn hours! And it's crappy. But I learned something :)

No comments: