Generates reference based on analog input
Dependents: locomotion_pid_action_refactor_EMG
refGen.cpp
- Committer:
- tvlogman
- Date:
- 2017-10-20
- Revision:
- 2:35c05e7698f5
- Parent:
- 0:5c67195a412d
- Child:
- 3:43d9f8db93b7
File content as of revision 2:35c05e7698f5:
#include "refGen.h" #include "mbed.h" // Member function definitions refGen::refGen(PinName a, float maxAngle):refPin(a), maxAngle(maxAngle), r_direction(false){ } float refGen :: getReferencePosition(float maxAngle, bool r_direction){ float r; if(r_direction == false){ // Clockwise rotation yields positive reference r = maxAngle*frefPin.read(); } if(r_direction == true){ // Counterclockwise rotation yields negative reference r = -1*maxAngle*refPin.read(); } return r; }