Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Oppgave4-4 by
main.cpp@0:c26cdf21261a, 2014-10-17 (annotated)
- Committer:
- tors
- Date:
- Fri Oct 17 11:48:37 2014 +0000
- Revision:
- 0:c26cdf21261a
- Child:
- 1:e6e3af75f623
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tors | 0:c26cdf21261a | 1 | #include "mbed.h" |
tors | 0:c26cdf21261a | 2 | DigitalOut LR(p18); |
tors | 0:c26cdf21261a | 3 | DigitalIn B1(p20); |
tors | 0:c26cdf21261a | 4 | |
tors | 0:c26cdf21261a | 5 | int main() |
tors | 0:c26cdf21261a | 6 | { |
tors | 0:c26cdf21261a | 7 | float i; |
tors | 0:c26cdf21261a | 8 | while(1) { |
tors | 0:c26cdf21261a | 9 | |
tors | 0:c26cdf21261a | 10 | while (B1==0) { |
tors | 0:c26cdf21261a | 11 | |
tors | 0:c26cdf21261a | 12 | wait(2.0); |
tors | 0:c26cdf21261a | 13 | LR = 1; |
tors | 0:c26cdf21261a | 14 | wait(2.0); |
tors | 0:c26cdf21261a | 15 | LR = 0; |
tors | 0:c26cdf21261a | 16 | } |
tors | 0:c26cdf21261a | 17 | while(B1==1) { |
tors | 0:c26cdf21261a | 18 | if(i>=2.0) { |
tors | 0:c26cdf21261a | 19 | wait(i); |
tors | 0:c26cdf21261a | 20 | LR=1; |
tors | 0:c26cdf21261a | 21 | wait(0.2); |
tors | 0:c26cdf21261a | 22 | LR=0; |
tors | 0:c26cdf21261a | 23 | } |
tors | 0:c26cdf21261a | 24 | |
tors | 0:c26cdf21261a | 25 | } |
tors | 0:c26cdf21261a | 26 | } |
tors | 0:c26cdf21261a | 27 | } |