LAB02_Oppgave1og2

Dependencies:   mbed

Committer:
kristoffermk
Date:
Thu Jan 21 17:22:37 2016 +0000
Revision:
0:978f11e31b3a
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kristoffermk 0:978f11e31b3a 1 #include "mbed.h"
kristoffermk 0:978f11e31b3a 2
kristoffermk 0:978f11e31b3a 3 BusOut Leds(PA_9,PC_7,PB_6,PA_7,PA_6,PA_5,PB_5,PB_4);
kristoffermk 0:978f11e31b3a 4 DigitalIn SW7(PB_3);
kristoffermk 0:978f11e31b3a 5 DigitalIn SW6(PA_10);
kristoffermk 0:978f11e31b3a 6
kristoffermk 0:978f11e31b3a 7
kristoffermk 0:978f11e31b3a 8 int main()
kristoffermk 0:978f11e31b3a 9 {
kristoffermk 0:978f11e31b3a 10 int teller=0;
kristoffermk 0:978f11e31b3a 11 Leds=~teller;
kristoffermk 0:978f11e31b3a 12
kristoffermk 0:978f11e31b3a 13 while (true)
kristoffermk 0:978f11e31b3a 14 {
kristoffermk 0:978f11e31b3a 15 if(SW7==0)
kristoffermk 0:978f11e31b3a 16 { teller=teller+1;
kristoffermk 0:978f11e31b3a 17 Leds=~teller;
kristoffermk 0:978f11e31b3a 18 wait_ms(2);
kristoffermk 0:978f11e31b3a 19 while(SW7==0){wait_ms(1);};
kristoffermk 0:978f11e31b3a 20 }
kristoffermk 0:978f11e31b3a 21 if (SW6==0)
kristoffermk 0:978f11e31b3a 22 { teller=teller-1;
kristoffermk 0:978f11e31b3a 23 Leds=~teller;
kristoffermk 0:978f11e31b3a 24 wait_ms(2);
kristoffermk 0:978f11e31b3a 25 while(SW6==0){wait_ms(1);};
kristoffermk 0:978f11e31b3a 26 }
kristoffermk 0:978f11e31b3a 27 }
kristoffermk 0:978f11e31b3a 28
kristoffermk 0:978f11e31b3a 29 }