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 wave_player Servo Motor SDFileSystem LSM9DS1_Library_cal HC_SR04_Ultrasonic_Library
main.cpp@0:7bbc230e00d6, 2010-11-23 (annotated)
- Committer:
- simon
- Date:
- Tue Nov 23 16:19:19 2010 +0000
- Revision:
- 0:7bbc230e00d6
- Child:
- 1:50d97a0b4c64
Use Motor library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:7bbc230e00d6 | 1 | // Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0) |
simon | 0:7bbc230e00d6 | 2 | |
simon | 0:7bbc230e00d6 | 3 | #include "mbed.h" |
simon | 0:7bbc230e00d6 | 4 | #include "Motor.h" |
simon | 0:7bbc230e00d6 | 5 | |
simon | 0:7bbc230e00d6 | 6 | Motor m(p23, p6, p5); // pwm, fwd, rev |
simon | 0:7bbc230e00d6 | 7 | |
simon | 0:7bbc230e00d6 | 8 | int main() { |
simon | 0:7bbc230e00d6 | 9 | for (float s= -1.0; s < 1.0 ; s += 0.01) { |
simon | 0:7bbc230e00d6 | 10 | m.speed(s); |
simon | 0:7bbc230e00d6 | 11 | wait(0.02); |
simon | 0:7bbc230e00d6 | 12 | } |
simon | 0:7bbc230e00d6 | 13 | } |