![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Joystick Controlled Servos
main.cpp
- Committer:
- Galib_Rahman
- Date:
- 2018-12-13
- Revision:
- 1:6dc9dbf60e67
- Parent:
- 0:7e748374bdff
File content as of revision 1:6dc9dbf60e67:
/* Joystick Controlled Servo Motors Developed 12|12|18 */ #include "mbed.h" #include "Servo.h" #include "Map.hpp" AnalogIn JoystickPin1(A0); AnalogIn JoystickPin2(A1); Servo ServoMotor1(D3); //Servo ServoMotor2(D4); Map AnalogPos(0,1023,0,180); int main() { float Position1,Position2; while (true) { Position1=AnalogPos.Calculate(JoystickPin1.read()); Position2=AnalogPos.Calculate(JoystickPin2.read()); ServoMotor1.position(Position1); printf("JoyStick1"); printf("%f",Position1); printf("JoyStick2"); printf("%f",Position2); ServoMotor1.position(Position1); } }