Sparki has a buzzer that can make sounds.
SparkiDrduino already has code examples for you to use:
File > Examples > Beep
How It Works
The buzzer on Sparki is a piezo electric buzzer. Piezo electric materials change their shape when electricity is applied to them: By turning voltage on and off to the piezoelectric material in the buzzer, the plate bends and moves the air back and forth: This plate moving air back and forth compresses the air to make sound waves that you can hear:Using the Part
With the basic Sparki code in place, you can make Sparki beep using this command:
1 |
sparki.beep(); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/******************************************* Basic Buzzer test Sparki has a buzzer on its back. Try making it beep! ********************************************/ #include <Sparki.h> // include the robot library void setup() { } void loop() { sparki.beep(); // Sparki beeps! delay(1000); // wait a second (1000 milliseconds) } |