C++ class for controlling DC motor with encoder feedback. Dependencies include LS7366LIB, MotCon, and PID.
Dependencies: PID LS7366LIB MotCon2
Diff: Axis.h
- Revision:
- 1:cd249816dba8
- Parent:
- 0:cf7192f9f99a
- Child:
- 2:653433f4ee72
--- a/Axis.h Mon Aug 31 17:14:20 2015 +0000 +++ b/Axis.h Thu Sep 24 16:47:02 2015 +0000 @@ -4,13 +4,13 @@ #define MBED_ROBOTARM_H #include "mbed.h" -#include "PID.h" -#include "LS7366.h" -#include "MotCon.h" +#include "PID.h" //library for software routine PID controller +#include "LS7366.h" //library for quadrature encoder interface IC's +#include "MotCon.h" //simple motor control routines class Axis{ public: - Axis(SPI& _spi, PinName _cs, PinName _pwm, PinName _dir, PinName _limit); + Axis(SPI& _spi, PinName _cs, PinName _pwm, PinName _dir, int* limit); void paramUpdate(void); void home(long halfcounts); void init(float); @@ -36,6 +36,7 @@ int moveStatus; int moveState; int debug; + int *ptr_limit; float countsPerDeg; //number of counts/revolution @@ -50,8 +51,7 @@ SPI _spi; DigitalOut _cs; PwmOut _pwm; - DigitalOut _dir; - DigitalIn _limit; + DigitalOut _dir; }; #endif