From a6382aab68ea513ffcae3e28f4339d1057a0702f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=BE=E5=90=89=E3=81=95=E3=82=93=28Tamakichi-?= =?UTF-8?q?San=29?= Date: Sun, 19 May 2019 08:55:10 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=83=97?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0=E3=81=AE=E4=B8=8D=E5=85=B7?= =?UTF-8?q?=E5=90=88=E3=80=81=E8=A8=98=E8=BF=B0=E3=83=9F=E3=82=B9=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MML/examples/MML_Play_STM32Ex/MML_Play_STM32Ex.ino | 8 ++++---- MML/examples/MML_Play_STM32Std/MML_Play_STM32Std.ino | 8 ++++---- MML/examples/MM_PLAY/MM_PLAY.ino | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/MML/examples/MML_Play_STM32Ex/MML_Play_STM32Ex.ino b/MML/examples/MML_Play_STM32Ex/MML_Play_STM32Ex.ino index f419409..aea7281 100644 --- a/MML/examples/MML_Play_STM32Ex/MML_Play_STM32Ex.ino +++ b/MML/examples/MML_Play_STM32Ex/MML_Play_STM32Ex.ino @@ -38,7 +38,7 @@ void debug(uint8_t c) { } // フォアグランド演奏の停止 -void OnStopPkay() { +void OnStopkey() { if (mml.isPlay()) { mml.stop(); Serial.println("Stop foreground playing"); @@ -49,8 +49,8 @@ void setup() { Serial.begin(115200); // フォアグランド演奏停止用ボタンの設定 - pinMode(PB8,INPUT_PULLUP); - attachInterrupt(PB8, OnStopPkay, FALLING); + pinMode(StopBtn,INPUT_PULLUP); + attachInterrupt(StopBtn, OnStopkey, FALLING); // キーボード入力待ち while (!Serial.available()) @@ -65,7 +65,7 @@ void setup() { Serial.println("Now foreground playing .."); mml.setText(mmltext); mml.play(); - detachInterrupt(PB8); + detachInterrupt(StopBtn); // タイマー割り込み設定 ticker.set(10, handle_timer); diff --git a/MML/examples/MML_Play_STM32Std/MML_Play_STM32Std.ino b/MML/examples/MML_Play_STM32Std/MML_Play_STM32Std.ino index d962b78..079f7b9 100644 --- a/MML/examples/MML_Play_STM32Std/MML_Play_STM32Std.ino +++ b/MML/examples/MML_Play_STM32Std/MML_Play_STM32Std.ino @@ -55,7 +55,7 @@ void debug(uint8_t c) { } // フォアグランド演奏の停止 -void OnStopPkay() { +void OnStopkey() { if (mml.isPlay()) { mml.stop(); Serial.println("Stop foreground playing"); @@ -66,8 +66,8 @@ void setup() { Serial.begin(115200); // フォアグランド演奏停止用ボタンの設定 - pinMode(PB8,INPUT_PULLUP); - attachInterrupt(PB8, OnStopPkay, FALLING); + pinMode(StopBtn,INPUT_PULLUP); + attachInterrupt(StopBtn, OnStopkey, FALLING); Serial.println("MML library sample. Hit any key to start."); @@ -82,7 +82,7 @@ void setup() { Serial.println("Now foreground playing .."); mml.setText(mmltext); mml.play(); - detachInterrupt(PB8); + detachInterrupt(StopBtn); // タイマー割り込み設定 ticker.set(10, handle_timer); diff --git a/MML/examples/MM_PLAY/MM_PLAY.ino b/MML/examples/MM_PLAY/MM_PLAY.ino index a79fab4..eb042e1 100644 --- a/MML/examples/MM_PLAY/MM_PLAY.ino +++ b/MML/examples/MM_PLAY/MM_PLAY.ino @@ -5,8 +5,9 @@ #include #include "MML.h" -#define TonePin 8 // 圧電スピーカー接続ピン -#define StopBtn 3 // フォアグランド演奏中断ボタン +#define TonePin 8 // 圧電スピーカー接続ピン +#define StopBtn 2 // フォアグランド演奏中断ボタン +#define StopBtnInt0 0 // フォアグランド演奏中断ボタンの割り込み番号 MML mml; // MML文演奏管理 @@ -16,7 +17,7 @@ void dev_toneInit() { // 単音出力関数 void dev_tone(uint16_t freq, uint16_t tm, uint16_t vol) { - tone(TonePin,freq); + tone(TonePin, freq); if (tm) { delay(tm); noTone(TonePin); @@ -54,7 +55,7 @@ void debug(uint8_t c) { } // フォアグランド演奏の停止 -void OnStopPkay() { +void OnStopkey() { if (mml.isPlay()) { mml.stop(); Serial.println("Stop foreground playing"); @@ -63,11 +64,10 @@ void OnStopPkay() { void setup() { Serial.begin(115200); - pinMode(13, OUTPUT); // フォアグランド演奏停止用ボタンの設定 pinMode(StopBtn,INPUT_PULLUP); - attachInterrupt(StopBtn, OnStopPkay, FALLING); + attachInterrupt(StopBtnInt0, OnStopkey, FALLING); Serial.println("MML library sample. Hit any key to start.");