Home Code Attiny13a buzzer example

Attiny13a buzzer example

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



attiny13 and piezo

attiny13 and piezo


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); //


5Pcs ATTINY13A-PU AVR Microcontroller Flash 20MHZ

20 PCS piezo buzzer

You may also like