I just submitted this project to the 1kB challenge too, because I realized that if I only replace the pinMode calls with a suitable DDRB command, I can get it small enough!
Sketch uses 888 bytes (10%) of program storage space. Maximum is 8,192 bytes.
Global variables use 119 bytes (23%) of dynamic memory, leaving 393 bytes for local variables. Maximum is 512 bytes.
You only need to change the setup() function:
void setup() {
DDRB = 1<<0 | 1<<1;
// Setup the PWM clock to ~62.5Hz for the servos.
TCCR0A = 2<<COM0A0 | 2<<COM0B0 | 3<<WGM00;
TCCR0B = 0<<WGM02 | 1<<CS00 | 1<<CS01 | 0<<CS02;
OCR0A = 0;
OCR0B = 0;
}
Discussions
Become a member
In order to follow projects & hackers or give likes
Already a member?you need to create an account.
Cool! I often write to registers to configure AVR peripherals with the exception of the serial port.
Are you sure? yes | no