Robin Handy
/
test1
main lauflicht test
main.cpp@2:54c01dcbfbc8, 2020-01-13 (annotated)
- Committer:
- rob117
- Date:
- Mon Jan 13 17:16:18 2020 +0000
- Revision:
- 2:54c01dcbfbc8
- Parent:
- 1:5756521122a8
- Child:
- 3:f82a2b7fb723
erste funktion nibbleLeds
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rob117 | 0:696d6bf92662 | 1 | #include "mbed.h" |
rob117 | 1:5756521122a8 | 2 | #define BUTTON1 p14 |
rob117 | 0:696d6bf92662 | 3 | |
rob117 | 0:696d6bf92662 | 4 | |
rob117 | 2:54c01dcbfbc8 | 5 | void nibbleLeds(int value); |
rob117 | 2:54c01dcbfbc8 | 6 | |
rob117 | 0:696d6bf92662 | 7 | BusOut myleds(LED1, LED2, LED3, LED4); |
rob117 | 0:696d6bf92662 | 8 | DigitalIn button(BUTTON1); |
rob117 | 0:696d6bf92662 | 9 | |
rob117 | 2:54c01dcbfbc8 | 10 | |
rob117 | 2:54c01dcbfbc8 | 11 | |
rob117 | 2:54c01dcbfbc8 | 12 | |
rob117 | 2:54c01dcbfbc8 | 13 | |
rob117 | 0:696d6bf92662 | 14 | const int INIT = 0x03; |
rob117 | 0:696d6bf92662 | 15 | |
rob117 | 0:696d6bf92662 | 16 | int main() { |
rob117 | 0:696d6bf92662 | 17 | while(1){ |
rob117 | 0:696d6bf92662 | 18 | myleds = 0x05; |
rob117 | 0:696d6bf92662 | 19 | if(button) |
rob117 | 0:696d6bf92662 | 20 | myleds = 0x0A; |
rob117 | 0:696d6bf92662 | 21 | wait(0.1); |
rob117 | 0:696d6bf92662 | 22 | } |
rob117 | 0:696d6bf92662 | 23 | |
rob117 | 0:696d6bf92662 | 24 | |
rob117 | 2:54c01dcbfbc8 | 25 | } |
rob117 | 1:5756521122a8 | 26 | |
rob117 | 2:54c01dcbfbc8 | 27 | void nibbleLeds(int value){ |
rob117 | 2:54c01dcbfbc8 | 28 | myleds = value%16; |
rob117 | 2:54c01dcbfbc8 | 29 | } |
rob117 | 2:54c01dcbfbc8 | 30 |