3.1.5
Dependencies: mbed
main.cpp@0:2ce973ba7202, 2017-09-12 (annotated)
- Committer:
- olemh88
- Date:
- Tue Sep 12 11:18:23 2017 +0000
- Revision:
- 0:2ce973ba7202
3.1.5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
olemh88 | 0:2ce973ba7202 | 1 | #include "mbed.h" |
olemh88 | 0:2ce973ba7202 | 2 | Serial pc(USBTX, USBRX); |
olemh88 | 0:2ce973ba7202 | 3 | BusOut teller(p21, p22, p23, p24, p25, p26); |
olemh88 | 0:2ce973ba7202 | 4 | DigitalOut bryter(p20); |
olemh88 | 0:2ce973ba7202 | 5 | DigitalOut bryter2(p19); |
olemh88 | 0:2ce973ba7202 | 6 | |
olemh88 | 0:2ce973ba7202 | 7 | |
olemh88 | 0:2ce973ba7202 | 8 | int main() |
olemh88 | 0:2ce973ba7202 | 9 | { |
olemh88 | 0:2ce973ba7202 | 10 | while(1) { |
olemh88 | 0:2ce973ba7202 | 11 | float a = 0.1; |
olemh88 | 0:2ce973ba7202 | 12 | if (bryter2 == 1) { |
olemh88 | 0:2ce973ba7202 | 13 | a = 1; |
olemh88 | 0:2ce973ba7202 | 14 | } |
olemh88 | 0:2ce973ba7202 | 15 | if (bryter == 0) { |
olemh88 | 0:2ce973ba7202 | 16 | for(int x = 0; x <= 15; x++) { |
olemh88 | 0:2ce973ba7202 | 17 | teller = x; |
olemh88 | 0:2ce973ba7202 | 18 | wait(a); |
olemh88 | 0:2ce973ba7202 | 19 | if (x == 15) { |
olemh88 | 0:2ce973ba7202 | 20 | for(int x = 15; x > 0; x--) { |
olemh88 | 0:2ce973ba7202 | 21 | teller = x; |
olemh88 | 0:2ce973ba7202 | 22 | wait(a); |
olemh88 | 0:2ce973ba7202 | 23 | } |
olemh88 | 0:2ce973ba7202 | 24 | } |
olemh88 | 0:2ce973ba7202 | 25 | } |
olemh88 | 0:2ce973ba7202 | 26 | } |
olemh88 | 0:2ce973ba7202 | 27 | if (bryter == 1) { |
olemh88 | 0:2ce973ba7202 | 28 | for(int x = 0; x <= 63; x++) { |
olemh88 | 0:2ce973ba7202 | 29 | teller = x; |
olemh88 | 0:2ce973ba7202 | 30 | wait(a); |
olemh88 | 0:2ce973ba7202 | 31 | if (x == 63) { |
olemh88 | 0:2ce973ba7202 | 32 | for(int x = 63; x > 0; x--) { |
olemh88 | 0:2ce973ba7202 | 33 | teller = x; |
olemh88 | 0:2ce973ba7202 | 34 | wait(a); |
olemh88 | 0:2ce973ba7202 | 35 | } |
olemh88 | 0:2ce973ba7202 | 36 | } |
olemh88 | 0:2ce973ba7202 | 37 | } |
olemh88 | 0:2ce973ba7202 | 38 | } |
olemh88 | 0:2ce973ba7202 | 39 | } |
olemh88 | 0:2ce973ba7202 | 40 | } |