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
main.cpp
- Committer:
- komachiangel72
- Date:
- 2019-12-06
- Revision:
- 1:3af0f173b7fe
- Parent:
- 0:51578a4c3bf8
File content as of revision 1:3af0f173b7fe:
#include "mbed.h"
//DigitalOut out(D10);//D10ピンへの出力をコントロール
//digitalOut→0or1(ONorOFF)をコントロール、
//myledはDigitalOut型の変数LED1のポートを初期化するという意味
//AnalogIn photo(A0);
//AnalogIn schmitt(A5);
InterruptIn enc(D10);
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 == 100 )break;
}
}