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.
Dependents: ROCO104_Buggy BuggyDesign
clickers.cpp@1:d5b76569b45c, 2020-02-15 (annotated)
- Committer:
- Mikebob
- Date:
- Sat Feb 15 12:45:57 2020 +0000
- Revision:
- 1:d5b76569b45c
- Parent:
- 0:cfb1fcccadd6
- Child:
- 2:2571dd52276f
Ultrasonics added;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Mikebob | 0:cfb1fcccadd6 | 1 | #include "mbed.h" |
| Mikebob | 0:cfb1fcccadd6 | 2 | #include "motor.h" |
| Mikebob | 0:cfb1fcccadd6 | 3 | #include "clickers.h" |
| Mikebob | 1:d5b76569b45c | 4 | #include "ultrasonic.h" |
| Mikebob | 0:cfb1fcccadd6 | 5 | |
| Mikebob | 0:cfb1fcccadd6 | 6 | extern DigitalIn microswitch1; //Instance of the DigitalIn class called 'microswitch1' |
| Mikebob | 0:cfb1fcccadd6 | 7 | extern DigitalIn microswitch2; //Instance of the DigitalIn class called 'microswitch2' |
| Mikebob | 0:cfb1fcccadd6 | 8 | extern Motor Wheel; |
| Mikebob | 1:d5b76569b45c | 9 | extern Serial pc; |
| Mikebob | 1:d5b76569b45c | 10 | extern int mm; |
| Mikebob | 1:d5b76569b45c | 11 | extern ultrasonic mu; |
| Mikebob | 0:cfb1fcccadd6 | 12 | void RevStop() |
| Mikebob | 0:cfb1fcccadd6 | 13 | { |
| Mikebob | 1:d5b76569b45c | 14 | while (microswitch1 == true || mm <= 300) |
| Mikebob | 0:cfb1fcccadd6 | 15 | { |
| Mikebob | 1:d5b76569b45c | 16 | pc.printf("%dmm\n\r", mm); |
| Mikebob | 0:cfb1fcccadd6 | 17 | microswitch1.read(); |
| Mikebob | 1:d5b76569b45c | 18 | mu.checkDistance(); |
| Mikebob | 0:cfb1fcccadd6 | 19 | Wheel.Stop(); |
| Mikebob | 0:cfb1fcccadd6 | 20 | } |
| Mikebob | 0:cfb1fcccadd6 | 21 | } |