Parts:
● Grove-Buzzer x1
● Grove cable x1
● Grove-Base BoosterPack x1
● LaunchPad Development Kit
Connections:
Plug the Buzzer module into Grove connector
J14 on the BoosterPack. This will link the SIG
pin of the buzzer to pin 39 of the LaunchPad.
Buzzer
The example use a buzzer to play melodies. It sends a square wave of the
appropriate frequency to the buzzer, generating the corresponding tone.
The circuit:
* Buzzer attached to pin39 (J14 plug on Grove Base BoosterPack)
* one side pin (either one) to ground
* the other side pin to VCC
* LED anode (long leg) attached to RED_LED
* LED cathode (short leg) attached to ground
* Note:
This example code is in the public domain.
http://www.seeedstudio.com/wiki/index.php?title=GROVE_-_Starter_Kit_v1.1b#Grove_-
_Buzzer
*/
/* Macro Define */
#define BUZZER_PIN 39 /* sig pin of the buzzer */
int length = 15; /* the number of notes */
char notes[] = "ccggaagffeeddc ";
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 300;
void setup()
{