// These includes are not needed when
// the Arduino layer is involved.
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>


#define BUZZER_PIN PORTB5

int main(void) 
{
  DDRB |= (1 << BUZZER_PIN); // Pino do BUZZER como saída

  while(1)
  {
    for (int i = 0; i < 200; i++) 
    {
      PORTB |= (1 << BUZZER_PIN);
      _delay_us(1000UL);
      PORTB &= ~(1 << BUZZER_PIN);
      _delay_us(1000UL);

      // The ATmega328P has an alternative way
      // to togle a pin:
      //   PINB = (1 << BUZZER_PIN);
      //   _delay_us(1000UL);
    }
    _delay_us(500000UL);
  }
}