スピーカーで音を鳴らす
Dependencies: mbed
main.cpp
- Committer:
- hagi_hara
- Date:
- 2015-08-15
- Revision:
- 1:42c121dda003
- Parent:
- 0:f5bba12ef049
- Child:
- 2:44b8465482f9
File content as of revision 1:42c121dda003:
//スピーカーを鳴らすサンプルコード #include "mbed.h" #define mC 261.626 //「ド」の周波数 //ピン設定 PwmOut speaker(dp1); int main() { //音を鳴らす speaker.period(1.0/mC); speaker = 0.5; //5秒待つ wait(5.0); //音を止める speaker = 0.0; while(true); }