sadasd

Dependencies:   mbed

Fork of Nucleo_read_button by joseph chen

Committer:
ittraining
Date:
Thu May 05 02:43:46 2016 +0000
Revision:
1:52e576abcb8a
Parent:
0:c9d8fcdda4d0
Child:
2:5d81a684944c
read button

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:c9d8fcdda4d0 1 #include "mbed.h"
bcostm 0:c9d8fcdda4d0 2
ittraining 1:52e576abcb8a 3 DigitalIn mybutton(PC_13);
bcostm 0:c9d8fcdda4d0 4 DigitalOut myled(LED1);
bcostm 0:c9d8fcdda4d0 5
bcostm 0:c9d8fcdda4d0 6 int main() {
ittraining 1:52e576abcb8a 7
ittraining 1:52e576abcb8a 8
bcostm 0:c9d8fcdda4d0 9 while(1) {
bcostm 0:c9d8fcdda4d0 10 if (mybutton == 0) { // Button is pressed
bcostm 0:c9d8fcdda4d0 11 myled = !myled; // Toggle the LED state
bcostm 0:c9d8fcdda4d0 12 wait(0.2); // 200 ms
bcostm 0:c9d8fcdda4d0 13 }
bcostm 0:c9d8fcdda4d0 14 }
bcostm 0:c9d8fcdda4d0 15 }
bcostm 0:c9d8fcdda4d0 16