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: Motor Servo mbed
main.cpp
- Committer:
- chadlewellyn
- Date:
- 2015-10-13
- Revision:
- 0:18862eeb0ae8
File content as of revision 0:18862eeb0ae8:
#include "mbed.h"
#include "Motor.h"
#include "Servo.h"
int main() {
float i;
Servo myservo1(p21);
myservo1 = 0;
myservo1.calibrate(0.0009, 90);
Servo myservo2(p22);
myservo2 = 0;
myservo2.calibrate(0.0009, 90);
while(1) {
for (i = 0; i <= 1.0; i+=0.01) {
myservo1 = i;
myservo2 = 1.0 - i;
wait(.05);
}
for (i = 1.0; i >= 0; i-=0.01) {
myservo1 = i;
myservo2 = 1.0 - i;
wait(.05);
}
Motor m(p25, p27, p28);
float s, n;
for (s = 0.2; s <= 1.0; += 0.1) {
n = -s;
m.speed(s);
wait(5);
m.speed(n);
wait(5);
}
}
}