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
3 comments:
Am I hearing Linkin Park in the background? Specifically about 0:50 into http://www.youtube.com/watch?v=oCSdLtNZbaA ?
Anyway that is beside the point. Pretty neato beginning, your first successful micro-controller attempt.
I agree, those yellow LEDs sure are hard to see.
Hey, don't get mad Paul, I know how you like to fly into insane rages that would make Ulrich Drepper blush with shame, but try to keep an open mind here. I thought this post would be a good guinea pig to try out the Google Code Prettifier.
I had to tweak the colors a little bit so that it would look proper on a black background, but the results speak for themselves. It looks like code, it is indented like code, and it has all the syntax highlighting that kids these days seem to go for. You can copy and paste it like nobody's business.
To use it when making a post, be sure to switch into edit html mode, and then surround the code with code tags and the proper language:
<code class="prettyprint lang-cpp">
// Your cpp code here
</code>
Anyway, thanks to YuriKolovsky for answering How to use prettify with blogger/blogspot?
Oh yes, and when you post your code, replace all of your < with < and all the > with >.
Post a Comment