EasyManua.ls Logo

SeeedStudio Grove Series - Page 21

Default Icon
51 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CODE
This example is available here: File > Sketchbook > LaunchPad_Kit > Grove_Modules > buzzer
/*
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()
{
批注 [9]: Update with latest code

Related product manuals