Generates reference based on analog input
Dependents: locomotion_pid_action_refactor_EMG
refGen.cpp
- Committer:
- tvlogman
- Date:
- 2017-10-27
- Revision:
- 6:a8a82cee2705
- Parent:
- 5:7186da6f562f
File content as of revision 6:a8a82cee2705:
#include "refGen.h" #include "mbed.h" // Member function definitions refGen::refGen(PinName a, float maxAngle):refPin(a), maxAngle(maxAngle), r_direction(false){ } double refGen :: getReference(){ double r; if(r_direction == false){ // Clockwise rotation yields positive reference r = maxAngle*refPin.read(); } if(r_direction == true){ // Counterclockwise rotation yields negative reference r = -1*maxAngle*refPin.read(); } return r; }