test with PID control to screen on your computer
Dependencies: Motor_with_encoder MODSERIAL QEI mbed
Fork of Project_motor by
Diff: main.cpp
- Revision:
- 9:986a0c5fba0e
- Parent:
- 6:b89ca8add6ee
--- a/main.cpp Mon Oct 09 15:05:54 2017 +0000 +++ b/main.cpp Wed Oct 11 06:57:28 2017 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #include "MODSERIAL.h" #include "encoder.h" +#include "QEI.h" // this program can turn the motor clockwise or counterclockwise depending on the value p or n typed into the terminal. with 's' you can stop the motor MODSERIAL pc(USBTX,USBRX); @@ -13,8 +14,8 @@ DigitalIn button2(D12); Ticker potmeterreadout; Ticker encoderreadout; -Encoder motor1(PTD0,PTC4); // motor 1 is from encoder, otherwise it would be a pain in the ass to change all that code to motorencoder - +Encoder motor1(PTD0,PTC4, true); // motor 1 is from encoder, otherwise it would be a pain in the ass to change all that code to motorencoder +//QEI motor1(PTD0, PTC4, NC, 64, QEI::X4_ENCODING); // maybe the speed readout works when using X4 decoding... But this may break the code... float PwmPeriod = 0.0001f;