CHECK SW AND LED ON

Dependencies:   mbed

Committer:
rajivwagle
Date:
Thu Mar 08 12:07:12 2018 +0000
Revision:
0:c80e5c67f08f
SW-LED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rajivwagle 0:c80e5c67f08f 1 #include "mbed.h"
rajivwagle 0:c80e5c67f08f 2
rajivwagle 0:c80e5c67f08f 3 DigitalOut myled1(p23);
rajivwagle 0:c80e5c67f08f 4
rajivwagle 0:c80e5c67f08f 5 DigitalOut myled2(p24);
rajivwagle 0:c80e5c67f08f 6
rajivwagle 0:c80e5c67f08f 7 DigitalIn switchinput1(p18);
rajivwagle 0:c80e5c67f08f 8
rajivwagle 0:c80e5c67f08f 9 DigitalIn switchinput2(p14);
rajivwagle 0:c80e5c67f08f 10
rajivwagle 0:c80e5c67f08f 11 int main() {
rajivwagle 0:c80e5c67f08f 12
rajivwagle 0:c80e5c67f08f 13 while(1){
rajivwagle 0:c80e5c67f08f 14
rajivwagle 0:c80e5c67f08f 15 if(switchinput1==1)
rajivwagle 0:c80e5c67f08f 16 {
rajivwagle 0:c80e5c67f08f 17
rajivwagle 0:c80e5c67f08f 18 myled1 = 0;
rajivwagle 0:c80e5c67f08f 19 wait(0.1);
rajivwagle 0:c80e5c67f08f 20 }
rajivwagle 0:c80e5c67f08f 21 else
rajivwagle 0:c80e5c67f08f 22 {
rajivwagle 0:c80e5c67f08f 23 myled1 = 1;
rajivwagle 0:c80e5c67f08f 24 wait(0.1);
rajivwagle 0:c80e5c67f08f 25 }
rajivwagle 0:c80e5c67f08f 26 if(switchinput2==1)
rajivwagle 0:c80e5c67f08f 27 {
rajivwagle 0:c80e5c67f08f 28
rajivwagle 0:c80e5c67f08f 29
rajivwagle 0:c80e5c67f08f 30 myled2 = 0;
rajivwagle 0:c80e5c67f08f 31 wait(0.1);
rajivwagle 0:c80e5c67f08f 32 }
rajivwagle 0:c80e5c67f08f 33 else
rajivwagle 0:c80e5c67f08f 34 {
rajivwagle 0:c80e5c67f08f 35
rajivwagle 0:c80e5c67f08f 36
rajivwagle 0:c80e5c67f08f 37 myled2 = 1;
rajivwagle 0:c80e5c67f08f 38 wait(0.1);
rajivwagle 0:c80e5c67f08f 39 }
rajivwagle 0:c80e5c67f08f 40 }
rajivwagle 0:c80e5c67f08f 41 }