デジタル入力のサンプルプログラム

Dependencies:   mbed

Committer:
GGU
Date:
Mon Jul 29 03:06:07 2019 +0000
Revision:
0:a4438272274f
Child:
1:cfda69754e51
test;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GGU 0:a4438272274f 1 #include "mbed.h"
GGU 0:a4438272274f 2
GGU 0:a4438272274f 3 DigitalIn enable(D12);
GGU 0:a4438272274f 4 DigitalOut myled(LED1);
GGU 0:a4438272274f 5
GGU 0:a4438272274f 6 int main() {
GGU 0:a4438272274f 7 while(1) {
GGU 0:a4438272274f 8 if(enable){ //SW is ON
GGU 0:a4438272274f 9 myled=!myled; //LED is OFF
GGU 0:a4438272274f 10 }
GGU 0:a4438272274f 11 wait(0.25); //0.25sec
GGU 0:a4438272274f 12 }
GGU 0:a4438272274f 13 }