Skriv antall blink

Dependencies:   mbed

Committer:
Voldread
Date:
Thu Oct 08 16:14:30 2015 +0000
Revision:
0:ab2d2270407a
Skriv antall blink

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Voldread 0:ab2d2270407a 1 #include "mbed.h"
Voldread 0:ab2d2270407a 2
Voldread 0:ab2d2270407a 3 //define LEDS
Voldread 0:ab2d2270407a 4 BusOut leds(D8,D9,D10,D11,D12,D13,D4,D5);
Voldread 0:ab2d2270407a 5 //define Buttons
Voldread 0:ab2d2270407a 6 BusIn buttons (A0,A1,A2,A3,A4,A5,D2,D3);
Voldread 0:ab2d2270407a 7
Voldread 0:ab2d2270407a 8 int main()
Voldread 0:ab2d2270407a 9 {
Voldread 0:ab2d2270407a 10 int antallBlink=0;
Voldread 0:ab2d2270407a 11 int e=0;
Voldread 0:ab2d2270407a 12
Voldread 0:ab2d2270407a 13 while(1)
Voldread 0:ab2d2270407a 14 {
Voldread 0:ab2d2270407a 15 printf("Skriv inn hvor mange ganger lysiodene skal blinke: \r\n");
Voldread 0:ab2d2270407a 16 scanf("%d",&antallBlink);
Voldread 0:ab2d2270407a 17
Voldread 0:ab2d2270407a 18 leds=~antallBlink;
Voldread 0:ab2d2270407a 19 for (e=0; e<antallBlink; e++) //
Voldread 0:ab2d2270407a 20 {
Voldread 0:ab2d2270407a 21 leds=0xFF;
Voldread 0:ab2d2270407a 22 wait_ms(500);
Voldread 0:ab2d2270407a 23 leds=0x00;
Voldread 0:ab2d2270407a 24 wait_ms(500);
Voldread 0:ab2d2270407a 25 }
Voldread 0:ab2d2270407a 26
Voldread 0:ab2d2270407a 27 }
Voldread 0:ab2d2270407a 28 }