![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
First commit at here
Dependencies: mbed Servo Motornew
main.cpp
- Committer:
- harrymunli
- Date:
- 2019-04-13
- Revision:
- 1:9284c57e84da
- Parent:
- 0:9dfae2e18414
- Child:
- 2:34ed8b55eba6
File content as of revision 1:9284c57e84da:
#include "mbed.h" #include "Servo.h" #include "Motor.h" /* Nama servo 4 3 21 22 1 */ Servo servo21(PA_7); Servo servo22(PB_6); Serial pc(D1, D0); void servo2(float f, float g){ servo21.write(f); servo22.write(g); pc.printf("%f", servo21.read()); pc.printf("\n"); pc.printf("%f", servo22.read()); pc.printf("\n"); } int main() { pc.baud(9600); pc.printf("test begin\n"); //tes servo21.calibrate(0.001,150); servo22.calibrate(0.001,150); servo21.write(0); servo22.write(1.0); while(1){ float m=0.0; float n=0.0; pc.scanf("%f",&m); pc.printf("test \n"); pc.scanf("%f",&n); pc.printf("test \n"); float f = m; float g = n; servo2(f,g); } }