Escolar Documentos
Profissional Documentos
Cultura Documentos
h>
#include <util/delay.h>
int main() {
int contador1 = 0;
int contador2 = 0;
int contador3 = 0;
// Configura��o do PWM 1
TCCR0A = (1 << COM0B1) | (1 << WGM01) | (1 << WGM00); // Fast PWM, non-inverting
mode
TCCR0B = (1 << CS01); // Prescaler = 8
// Duty inicial de 0%
OCR0B = 0;
while (1) {
// Leitura do estado do bot�o 1
if (!(PIND & (1 << PD1))) {
_delay_ms(500);
if (contador1 == 0) {
contador1 = 1;
} else {
contador1 = 0;
}
}