*** ****
Dependencies: mbed
main.cpp@0:92e813cd7f42, 2015-10-09 (annotated)
- Committer:
- knut_johan
- Date:
- Fri Oct 09 15:12:00 2015 +0000
- Revision:
- 0:92e813cd7f42
l?reboka
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
knut_johan | 0:92e813cd7f42 | 1 | #include "mbed.h" |
knut_johan | 0:92e813cd7f42 | 2 | |
knut_johan | 0:92e813cd7f42 | 3 | BusOut display(D11,D10,D9,D5,D4,D3,D2,D1); |
knut_johan | 0:92e813cd7f42 | 4 | |
knut_johan | 0:92e813cd7f42 | 5 | int main() |
knut_johan | 0:92e813cd7f42 | 6 | { while(1) { // while loop |
knut_johan | 0:92e813cd7f42 | 7 | for(int i=0;i<4;i++) { // for loop |
knut_johan | 0:92e813cd7f42 | 8 | switch(i) { // switch |
knut_johan | 0:92e813cd7f42 | 9 | case 0: display = 0x3F; break; // viser '0' (0)011 1111 -> 3F |
knut_johan | 0:92e813cd7f42 | 10 | case 1: display = 0x06; break; // viser '1' (0)000 0110 -> 06 |
knut_johan | 0:92e813cd7f42 | 11 | case 2: display = 0x5B; break; // viser '2' (0)101 1011 -> 5B |
knut_johan | 0:92e813cd7f42 | 12 | case 3: display = 0x4F; break; // viser '3' (0)100 1111 -> 4F |
knut_johan | 0:92e813cd7f42 | 13 | } // end switch |
knut_johan | 0:92e813cd7f42 | 14 | wait(0.5); |
knut_johan | 0:92e813cd7f42 | 15 | } // end for loop |
knut_johan | 0:92e813cd7f42 | 16 | } // end while loop |
knut_johan | 0:92e813cd7f42 | 17 | } // end main |