![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
3.2.4
Dependencies: mbed
main.cpp
- Committer:
- olemh88
- Date:
- 2017-09-12
- Revision:
- 0:a7425af6fdde
File content as of revision 0:a7425af6fdde:
#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); } } } }