Fatima Vunic
/
LAB_Led2
g
Diff: leds2.cpp
- Revision:
- 1:210e74bbbe34
diff -r 30dbbeb201f5 -r 210e74bbbe34 leds2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/leds2.cpp Thu Dec 05 18:57:15 2019 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" + +// LSB MSB +// 2^0 2^1 2^2 2^3 2^7 +BusOut lb(D2, D3, D6, D9, D11, D12, A6, D13); + +void main() +{ + while(1) + { + BitsSetzen(); + } +} + +void BitsSetzen() +{ + lb = 1; // B#0001 D2 leuchtet + wait_ms(500); + lb = 2; // B#0010 D3 leuchtet + wait_ms(500); + lb = 3; // B#0011 D2 und D3 leuchten + wait_ms(500); + lb = 4; // B#0100 D6 leuchtet + wait_ms(500); + lb = 8; // B#1000 D9 leuchtet +} + +