Buzzer
This piezo buzzer has built in circuitry that produces audible buzzer tone. It has just two wires, a line in and Ground.
Even melody can be achieved with proper notes.
Circuit
Arduino | Sensor |
Pin 6 | RED Wire |
GND | BLACK Wire |
Code
void setup() { } void loop() { // play a note on pin 6 for 200 ms: tone(6, 440, 200); delay(200); // turn off tone function for pin 6: noTone(6); delay(300); }