70
What about active buzzer?
The use method is almost the same.
Think about it and try to make an audible beep from active buzzer.
Test code is showed below:
int buzzer=2;// initialize digital IO pin that controls the buzzer
void setup()
{
pinMode(buzzer,OUTPUT);// set pin mode as "output"
}
void loop()
{
digitalWrite(buzzer, HIGH); // produce sound
}
From the test code, we can know the buzzer's positive lead (long lead)