
runli2
Dependencies: mbed
main.cpp@0:622edc672f7f, 2015-03-16 (annotated)
- Committer:
- trivla
- Date:
- Mon Mar 16 15:28:51 2015 +0000
- Revision:
- 0:622edc672f7f
rl2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
trivla | 0:622edc672f7f | 1 | #include "mbed.h" |
trivla | 0:622edc672f7f | 2 | |
trivla | 0:622edc672f7f | 3 | //Flankenerkennung mit interrupt |
trivla | 0:622edc672f7f | 4 | BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); |
trivla | 0:622edc672f7f | 5 | |
trivla | 0:622edc672f7f | 6 | InterruptIn sw4(P1_16); |
trivla | 0:622edc672f7f | 7 | void OneRunLightStep(); |
trivla | 0:622edc672f7f | 8 | |
trivla | 0:622edc672f7f | 9 | void Sw4ISR() |
trivla | 0:622edc672f7f | 10 | { |
trivla | 0:622edc672f7f | 11 | OneRunLightStep(); |
trivla | 0:622edc672f7f | 12 | } |
trivla | 0:622edc672f7f | 13 | |
trivla | 0:622edc672f7f | 14 | int main() { |
trivla | 0:622edc672f7f | 15 | sw4.rise(Sw4ISR); |
trivla | 0:622edc672f7f | 16 | while(1) |
trivla | 0:622edc672f7f | 17 | { |
trivla | 0:622edc672f7f | 18 | |
trivla | 0:622edc672f7f | 19 | } |
trivla | 0:622edc672f7f | 20 | } |
trivla | 0:622edc672f7f | 21 | void OneRunLightStep() |
trivla | 0:622edc672f7f | 22 | { |
trivla | 0:622edc672f7f | 23 | if(lb==0) |
trivla | 0:622edc672f7f | 24 | lb=1; |
trivla | 0:622edc672f7f | 25 | else |
trivla | 0:622edc672f7f | 26 | lb = lb << 1; |
trivla | 0:622edc672f7f | 27 | |
trivla | 0:622edc672f7f | 28 | } |