Chelsea M
/
Nucleo_pwm
Revision 0:c21b120b95fa, committed 2019-09-29
- Comitter:
- chelseamar
- Date:
- Sun Sep 29 16:26:57 2019 +0000
- Commit message:
- Initial commit
Changed in this revision
diff -r 000000000000 -r c21b120b95fa Servo.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Sun Sep 29 16:26:57 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/Servo/#36b69a7ced07
diff -r 000000000000 -r c21b120b95fa main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Sep 29 16:26:57 2019 +0000 @@ -0,0 +1,69 @@ +// Continuously sweep the servo through it's full range +#include "mbed.h" +#include "Servo.h" +#include <iostream> + +Servo S1(D3);//old 1 +Servo S3(D6);//old 2 +Servo S5(D10);//old 3 +Servo S2(D5);//old 4 +Servo S6(D11);//old 5 +Servo S4(D9);//old 6 + +//Servo servos[6]; + +int range=100.0; + +int main() { + + //Calibrate the motors + S1.calibrate(0.001, 180); + S3.calibrate(0.001, 180); + S5.calibrate(0.00083, 180); + S2.calibrate(0.001, 180); + S6.calibrate(0.00084, 180); + S4.calibrate(0.00098, 180); + + int motor_select; + float position; + wait(0.5); + + printf("\r\nSelect motor: "); + cin >> motor_select; +// motor_select -= 1; + + if (motor_select == 5) + position = S5.read(); + + printf("\r\n %f", position); + + float pos; + printf("\r\nWhere should the motor go?"); + cin >> pos; + S5 = pos; + wait(1.0); + + printf("%f", S5.read()); + +// myservo.calibrate(0.00098, 180); +// while(1) { +// for(int i=0; i<100; i++) { +// myservo = i/100.0; +// wait(0.01); +// } +// +// wait(2.0); +// +// for(int i=100; i>0; i--) { +// myservo = i/100.0; +// wait(0.01); +// } +// +// wait(2.0); +// } +// +// myservo.write(1); +// wait(2.0); +// myservo.write(0); +// wait(2.0); +}
diff -r 000000000000 -r c21b120b95fa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Sep 29 16:26:57 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file