Prototype
Dependencies: mbed ButtonEventDemo
Lauflicht.cpp@13:024d65ed9c26, 2020-01-13 (annotated)
- Committer:
- Kelrath1984
- Date:
- Mon Jan 13 17:19:33 2020 +0000
- Revision:
- 13:024d65ed9c26
- Parent:
- 12:e4ee1507e722
- Child:
- 14:0ccc3d5ca8ce
add nibbleLeds
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kelrath1984 | 12:e4ee1507e722 | 1 | #include "mbed.h" |
Kelrath1984 | 12:e4ee1507e722 | 2 | |
Kelrath1984 | 12:e4ee1507e722 | 3 | #define BUTTON1 p14 |
Kelrath1984 | 12:e4ee1507e722 | 4 | #define INIT 0x03; |
Kelrath1984 | 12:e4ee1507e722 | 5 | |
Kelrath1984 | 12:e4ee1507e722 | 6 | |
Kelrath1984 | 12:e4ee1507e722 | 7 | int modifyBit(int x, unsigned char position, bool state); |
Kelrath1984 | 12:e4ee1507e722 | 8 | int lauflicht(bool richtung, int time, int &anz); |
Kelrath1984 | 13:024d65ed9c26 | 9 | void nibbleLeds(int value); |
Kelrath1984 | 12:e4ee1507e722 | 10 | //void printb(uint_t x); |
Kelrath1984 | 12:e4ee1507e722 | 11 | |
Kelrath1984 | 12:e4ee1507e722 | 12 | BusOut myleds(LED1, LED2, LED3, LED4); |
Kelrath1984 | 12:e4ee1507e722 | 13 | DigitalIn button(BUTTON1); |
Kelrath1984 | 12:e4ee1507e722 | 14 | |
Kelrath1984 | 12:e4ee1507e722 | 15 | int main(){ |
Kelrath1984 | 13:024d65ed9c26 | 16 | uint8_t value=INIT; |
Kelrath1984 | 13:024d65ed9c26 | 17 | |
Kelrath1984 | 12:e4ee1507e722 | 18 | while(1){ |
Kelrath1984 | 13:024d65ed9c26 | 19 | nibbleLeds(value); |
Kelrath1984 | 12:e4ee1507e722 | 20 | if(button) |
Kelrath1984 | 12:e4ee1507e722 | 21 | { |
Kelrath1984 | 12:e4ee1507e722 | 22 | myleds=0x0A; |
Kelrath1984 | 12:e4ee1507e722 | 23 | } |
Kelrath1984 | 13:024d65ed9c26 | 24 | wait(0.1); |
Kelrath1984 | 12:e4ee1507e722 | 25 | } |
Kelrath1984 | 13:024d65ed9c26 | 26 | } |
Kelrath1984 | 13:024d65ed9c26 | 27 | |
Kelrath1984 | 13:024d65ed9c26 | 28 | void nibbleLeds(int value){ |
Kelrath1984 | 13:024d65ed9c26 | 29 | myleds=value%16; |
Kelrath1984 | 12:e4ee1507e722 | 30 | } |