DC motor and Servo
Dependencies: DC_Motor Servo mbed
Fork of Lab2_41 by
main.cpp
- Committer:
- Red_Nova_Six
- Date:
- 2018-10-03
- Revision:
- 1:88e499bfdcc7
- Parent:
- 0:5ea7adc7e9cf
- Child:
- 2:ecf535666eb3
File content as of revision 1:88e499bfdcc7:
#include "mbed.h" #include "Servo.h" #include "Motor.h" Servo myservo(p21); Servo myservo2(p22); Motor(PinName pwm, PinName fwd, PinName rev): int i; int main() { myservo.calibrate(0.0009,90); myservo2.calibrate(0.0009, 90); while(1) { for( i=0; i<180; i++) { myservo = i/180.0; myservo2=(180.0-i)/180.0; wait(0.025); } for( i=180; i>0; i--) { myservo = i/180.0; myservo2=(180.0-i)/180.0; wait(0.025); } } }