Freedom Seeed Grove Buzzer Example
Dependencies: mbed
Fork of frdm_Grove_Buzzer_Example by
Simply Import this Program into your mbed compiler
Select Compile to generate the binary file
Plug the Grove Shield v2 on the top of your FRDM-K64F
Connect on end of the 4-pin Grove cable to the Buzzer module and the other end to the port D2 of the Grove Adapter.
Drag n drop the frdm_Grove_Buzzer_Example_K64F.bin into the mbed drive from your file explorer
Wait for download to complete
Press the Reset/SW1 button of your FRDM-K64F board to launch the program
The RGB LED should now power on Green
Press the SW2 user push-button of the FRDM-K64F and you should hear the buzzer ringing while RGB LED will power off.
To stop the buzzer, just release the SW2 button and press it again
Happy Buzzer'ing :D
main.cpp
- Committer:
- GregC
- Date:
- 2016-01-02
- Revision:
- 0:53c936ea1ae7
File content as of revision 0:53c936ea1ae7:
#include "mbed.h"
DigitalOut buzzer(D2);
DigitalOut led_green(LED_GREEN);
InterruptIn sw2(SW2);
void sw2_release(void)
{
led_green = !led_green;
buzzer = !buzzer;
printf("On-board button SW2 was released.\n");
}
int main()
{
sw2.rise(&sw2_release);
while (true) {
}
}
