![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
3.2.4
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:a7425af6fdde
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 12 12:12:43 2017 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" + +DigitalOut Led1(LED1); +DigitalOut Led4(LED4); + +Serial pc(USBTX, USBRX); +int x = 0; +int pulser; +int ms; +int LED; + +int main() +{ + while(1) { + int z = Led1; + int y = Led4; + z = 1; + y = 4; + pc.printf("Skriv inn antall pulser: "); + pc.scanf("%d", &pulser); + pc.printf("Skriv inn antall ms: "); + pc.scanf("%d", &ms); + pc.printf("Velg hvilken diode som skal lyse Led1 eller led4: "); + pc.scanf("%d", &LED); + if ( LED != 1 || 4) { + pc.printf("Prov igjen, feil valg\n"); + } + for(x = 0; x < pulser; x++) { + if (LED == x) { + Led1 = 1; + wait_ms(ms); + Led1 = 0; + wait_ms(ms); + } + if (LED == y) { + Led4 = 1; + wait_ms(ms); + Led4 = 0; + wait_ms(ms); + } + } + + } +}