Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:48ce5ea63822, committed 2019-09-15
- Comitter:
- knzw
- Date:
- Sun Sep 15 07:21:09 2019 +0000
- Commit message:
- Press USER_BUTTON0 to light up the LED.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Sun Sep 15 07:21:09 2019 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Sep 15 07:21:09 2019 +0000
@@ -0,0 +1,47 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2018 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/* ボタン押している間なにかする処理のサンプルプログラム的な(モーメンタリ動作というらしい) */
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+#define SLEEP_TIME 500 // (msec)
+#define PRINT_AFTER_N_LOOPS 20
+
+static InterruptIn btn0(USER_BUTTON0);
+static bool btndownflg=false; //falseのとき、ボタンを離している
+
+void btnfall0(void){
+ btndownflg=true;//ボタンおした
+}
+
+void btnrise0(void){
+ btndownflg=false;//ボタンはなれた
+}
+
+
+int main(){
+
+ btn0.fall(&btnfall0); //ボタンを押したときに関数btnfall0を呼び出す
+ btn0.rise(&btnrise0); //ボタンを離したときに関数をbtnrise0を呼び出す
+
+ while (true) {
+ if(btndownflg){
+ led1=true;
+ led2=true;
+ led3=true;
+ led4=true;
+ }else{
+ led1=false;
+ led2=false;
+ led3=false;
+ led4=false;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Sun Sep 15 07:21:09 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#5941d1718339116cd12914238ec331c84da3d08f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json Sun Sep 15 07:21:09 2019 +0000
@@ -0,0 +1,11 @@
+{
+ "target_overrides": {
+ "*": {
+ "platform.stack-stats-enabled": true,
+ "platform.heap-stats-enabled": true,
+ "platform.cpu-stats-enabled": true,
+ "platform.thread-stats-enabled": true,
+ "platform.sys-stats-enabled": true
+ }
+ }
+}