Hey folks, I am working on an attiny84 bike light, it's main feature is a cylon light fade chase. I found some code from atmel and adapted it, and I'm having a few issues I hope you can shed some light on.
The project is here:
Here are my issues:
1. If i delete one of my variables (char wtf) the program stops working! it's the most bizarre thing ever -- everything works great when the variable is there. Even if I change it's name, it still works fine. Any ideas? I'm totally stumped! I've tried compiling on Linux and in Windows using Atmel Studio. At no point is this char used in the program... completely weird.
2. The software pwm used a volatile array hold pwm values and then one by one copied the values in to the compare array. I have switched that to a memcpy, and it seems to work fine, am I doing something stupid here?
compare = compbuff; // verbose code for speed compare = compbuff; compare = compbuff; compare = compbuff; compare = compbuff; ...
memcpy(compare, led_bright, CHMAX*sizeof(int));
3. Is there any way to cut down on the repetitive #defines, say like a for loop or something? Also if I want to alter the number of channels it would be much easier if I did this.
#define LED0 PA0 // assign LED names to output ports on the attiny84 #define LED1 PA1 #define LED2 PA2 #define LED3 PA3 #define LED4 PA4 #define LED5 PA5 #define LED6 PA6
Sorry for being such a n00b, I'd REALLY appreciate your help though!