![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Joystick Controlled Servos
main.cpp
- Committer:
- Galib_Rahman
- Date:
- 2018-12-12
- Revision:
- 0:7e748374bdff
- Child:
- 1:6dc9dbf60e67
File content as of revision 0:7e748374bdff:
/* Joystick Controlled Servo Motors Developed 12|12|18 Courtesy of Galib F. Rahman */ #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); Position2=AnalogPos.Calculate(JoystickPin2); ServoMotor1.position(Position1); ServoMotor2.position(Position2); } }