my program

Dependencies:   mbed

Fork of DigitalIn_HelloWorld_Mbed by mbed official

Committer:
shiyilei
Date:
Mon Oct 13 03:26:12 2014 +0000
Revision:
4:65c7b7e82f34
Parent:
3:e2f865861a7a
This is a program to handle key message

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shiyilei 4:65c7b7e82f34 1 /***********************************************
shiyilei 4:65c7b7e82f34 2 *file name:model key
shiyilei 4:65c7b7e82f34 3 *creator: Jacob Shi
shiyilei 4:65c7b7e82f34 4 *time: 2014/10/13
shiyilei 4:65c7b7e82f34 5 *description: the program imitates a model key
shiyilei 4:65c7b7e82f34 6 ***********************************************/
mbed_official 0:aaf5a9d465fd 7 #include "mbed.h"
shiyilei 4:65c7b7e82f34 8 DigitalIn key(P0_9);
shiyilei 4:65c7b7e82f34 9 DigitalOut myled(LED1);
shiyilei 4:65c7b7e82f34 10 int main(int argc, char const *argv[])
shiyilei 4:65c7b7e82f34 11 {
shiyilei 4:65c7b7e82f34 12 myled=0;
shiyilei 4:65c7b7e82f34 13 while(1)
shiyilei 4:65c7b7e82f34 14 {
shiyilei 4:65c7b7e82f34 15 if(key)
shiyilei 4:65c7b7e82f34 16 {
shiyilei 4:65c7b7e82f34 17 wait_ms(10);
shiyilei 4:65c7b7e82f34 18 if(key)
shiyilei 4:65c7b7e82f34 19 myled=1;
mbed_official 0:aaf5a9d465fd 20 }
shiyilei 4:65c7b7e82f34 21 else
shiyilei 4:65c7b7e82f34 22 myled=0;
mbed_official 0:aaf5a9d465fd 23 }
shiyilei 4:65c7b7e82f34 24 return 0;
mbed_official 0:aaf5a9d465fd 25 }