Driver buzzer on LinkNode to play music!

Dependencies:   mbed

The LinkNode, also called Mbed BLE Sensors tag, which is a bluetooth 4.0 BLE sensor development board and it is powered by Mbed. It integrates powerful devices, such as NRF51822, LIS3DH ,BMP180, buzzer, and dual-color LED. It also embeds an mbed compatible programmer to make program and download application very convenient.

The mbed BLE sensors tag is consisted of two modules: one is a bluetooth 4.0 BLE sensors tag powered by NRF51822 which is a Bluetooth Low Energy & 2.4GHz Wireless SOC. This mbed BLE sensor tag is mbed-enabled device which simplifies and speeds up the creation and deployment of bluetooth devices based on ARM micro-controllers. There is an mbed library supporting BLE sensors tag which provides the C/C++ software platform and libraries, and can speed up your BLE application development.

The other one works as a programmer like Jlink, but it is compatible with ARM’s mbed. It greatly simplifies the programming process. You just copy the compiled hex file to an emulated disk, which is recognized by PC when you plug this programmer into the PC and the programmer will automatically download the program into BLE SENSORS TAG without any other setting.

/media/uploads/youkee/1.jpg

Pin map of LinkNode

/media/uploads/youkee/linknode-chip-map_-1-.png

Files at this revision

API Documentation at this revision

Comitter:
youkee
Date:
Thu Apr 14 01:54:38 2016 +0000
Commit message:
Driver Buzzer on LinkNode to play music!

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 878f20e5795a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 14 01:54:38 2016 +0000
@@ -0,0 +1,14 @@
+#include "mbed.h"
+PwmOut buzzer(p22);
+//频率数组
+float frequency[]={659,554,659,554,440,494,554,587,494,659,554,440};
+float beat[]={1,1,1,1,1,0.5,0.5,1,1,1,1,2}; //节拍数组
+int main() {
+while (1) {
+for (int i=0;i<=11;i++) {
+buzzer.period(1/(2*frequency[i])); // 设置PWM周期
+buzzer=0.5; // 设置占空比
+wait(0.4*beat[i]); // 保持节拍周期
+}
+}
+}
\ No newline at end of file
diff -r 000000000000 -r 878f20e5795a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 14 01:54:38 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96
\ No newline at end of file