Friday, September 11, 2009

Mirco controls (avr atmel) o yea

So I have been doing a lot of reading up on micro-controllers lately. I got avropendous that supports usb. The avropendous package has been nice, and I would tell anyone they should start with something like that. It is cool because you can flash the controller over usb with a couple of command from linux

sudo dfu-programmer atmega32u4 erase
sudo dfu-programmer atmega32u4 flash --debug 1 program.hex

I made a simple example of some code I found:


#define F_CPU 10000000UL
#include <avr/io.h>
#include <util/delay.h>

void delayms(uint16_t millis) {
while ( millis )
{
_delay_ms(1);
millis--;
}
}

int main(void)
{
uint8_t i;
while(1)
{
for(i=0; i<256; ++i)
{
PORTB = i; /* LED on */
delayms(10);
}
}
return 0;
}


Anyway it looks like