2.8K
In this example we connect a piezo buzzer to PB0 of our Attiny13a. We use mikroC pro for AVR which has a built in sound library to play a tone
Schematic
Code
As stated earlier we use mikroC pro for AVR, this contains a sound library.
[codesyntax lang=”c”]
void main()
{
DDRB = 0x00; // Configure PORTB as input
Sound_Init(&PORTB,0); // Initialize sound pin
while (1)
{ // endless loop
Sound_Play(659, 250); //
delay_ms(2000);
}
}
[/codesyntax]
Links
5Pcs ATTINY13A-PU AVR Microcontroller Flash 20MHZ

