a

Dependencies:   mbed

Committer:
AK1412
Date:
Sat Oct 20 01:26:25 2018 +0000
Revision:
0:f429cba13b88
a; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AK1412 0:f429cba13b88 1 #include "mbed.h"
AK1412 0:f429cba13b88 2
AK1412 0:f429cba13b88 3 InterruptIn button(D2);
AK1412 0:f429cba13b88 4 DigitalIn buttoon(D12);
AK1412 0:f429cba13b88 5 Serial pc (USBTX,USBRX);
AK1412 0:f429cba13b88 6
AK1412 0:f429cba13b88 7 int count=0;
AK1412 0:f429cba13b88 8 void interrupt(){
AK1412 0:f429cba13b88 9 int b = buttoon.read();
AK1412 0:f429cba13b88 10 if( b==0)
AK1412 0:f429cba13b88 11 count ++;
AK1412 0:f429cba13b88 12 else
AK1412 0:f429cba13b88 13 count --;
AK1412 0:f429cba13b88 14 pc.printf("%d\n",count);
AK1412 0:f429cba13b88 15 }
AK1412 0:f429cba13b88 16 int main() {
AK1412 0:f429cba13b88 17 button.rise(interrupt);
AK1412 0:f429cba13b88 18 while(1) {
AK1412 0:f429cba13b88 19 }
AK1412 0:f429cba13b88 20 }