int main(void) { init_ports(); init_timer(); init_pin_interrupt(); sei(); // Enable global interrupts while (1) { start_sleep(); } return 0; }
int main() { init_timer_0(); init_pin_interrupt(PCINT0); init_adc(); util_init(); // Outputs DDRB |= (1 << PB1); DDRB |= (1 << PB3); DDRB |= (1 << PB4); PORTB &= ~(1 << PB3); // Set LED low PORTB &= ~(1 << PB1); // Set Servo pin low // Inputs DDRB &= ~(1 << PB0); /* Set PB0 as input */ PORTB |= (1 << PB0); /* Activate PULL UP resistor */ // Toggle LED PORTB ^= (1 << PB3); _delay_ms(1000); PORTB ^= (1 << PB3); // Enable global interrupts sei(); while(1) { reading = read_analog(); reading_map = map(reading, 0, 255, 410, 1580, 1) / 1000.0 / 0.01; } }