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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:51578a4c3bf8
- Child:
- 1:3af0f173b7fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Oct 17 03:18:37 2019 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+
+//DigitalOut out(D10);//D10ピンへの出力をコントロール
+//digitalOut→0or1(ONorOFF)をコントロール、
+//myledはDigitalOut型の変数LED1のポートを初期化するという意味
+
+//AnalogIn photo(A0);
+//AnalogIn schmitt(A5);
+
+InterruptIn enc(A5);
+DigitalOut led(LED1);
+
+int counter =0;
+
+void event_handler(void){
+ counter++;
+ led =!led;
+}
+
+int main() {
+ //out = 1; // 電流を流す
+ enc.rise(&event_handler);
+ enc.fall(&event_handler);
+
+ int i = 0;
+
+ while(1) {//組み込み型のプログラムは無限ループになるようにする。(終わってはいけない)
+
+ //wait(1.0); // 1 sec
+ //printf("photo:L432[%.3f]>\n",photo.read()*3.3F);//電圧測定
+
+ //wait(1.0);
+ //printf("schmitt:L432[%.3f]>\n",schmitt.read()*3.3F);//電圧測定
+
+ printf("%d\n",counter);
+
+ wait(1.0);
+
+ i++;
+ if (i == 10 )break;
+
+ }
+}
\ No newline at end of file