Library to control a 3DOF leg with a PCA9685.
Diff: HEXAPOD_LEG.h
- Revision:
- 0:ead365546ca5
- Child:
- 3:9cc530686346
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HEXAPOD_LEG.h Sat Apr 09 18:57:46 2016 +0000 @@ -0,0 +1,40 @@ +#ifndef HEXAPOD_LEG_LIBRARY_H +#define HEXAPOD_LEG_LIBRARY_H + +#include "PCA9685.h" +#include "mbed.h" +#include "structs.h" + +class Hexapod_Leg { + + public: + Hexapod_Leg(PCA9685 Driver, calibrated_leg_centre leg_cent, calibrated_leg_1_degree leg_step, leg_outputs leg_out, bool ON_RHS); + void set_joint_angles(float angle_a, float angle_b, float angle_c); + + + private: + float angle_to_pwm(float angle, char joint); + + private: + float a_ref; + float b_ref; + float c_ref; + + float a_1deg; + float b_1deg; + float c_1deg; + + int a_pin; + int b_pin; + int c_pin; + + bool RHS; + + PCA9685 driver; + +}; + + + + +#endif \ No newline at end of file