Saturday, March 08, 2008

atmega168 bug

I just discovered a bug that may have plagued some of you who've tried the same code and circuit I describe here. I've previously used an older arduino with an atmega8 chip, which works smoothly. I just got a newer arduino with an atmega168, and I was so excited that I didn't have to manually reset every time I wanted to upload new code. Sadly, when I plugged in my newly soldered remote, I found that every time I tried to toggle the play/pause, I also advanced the song and vice versa. When I look at the serial data the two arduinos are sending, it turns out they're different. The atmega168 adds a lot of other unwanted stuff, as below. I'm unsure why this is at the moment or how to fix it, but Tom Igoe has been consulted, so hopefully we'll have an answer soon.

Atmega168 Play/Pause
FA
FF
55
3
2
0
1
FA
3C01
F3
FF
55
3
2
0
8
F3
3E01

Atmega8 Play/Pause
FA
FF
55
3
2
0
1
FA
FFFF9C00