Combination of working libraries useful for the BioRobotics course.

Dependencies:   mbed QEI HIDScope BiQuad4th_order biquadFilter MODSERIAL FastPWM

Committer:
sanou8
Date:
Mon Oct 14 09:48:55 2019 +0000
Revision:
2:3feeeb434275
Parent:
1:b862262a9d14
Child:
3:695daa59763d
motor encoder test 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RobertoO 0:67c50348f842 1 #include "mbed.h"
RobertoO 0:67c50348f842 2 //#include "HIDScope.h"
sanou8 2:3feeeb434275 3 #include "QEI.h"
RobertoO 1:b862262a9d14 4 #include "MODSERIAL.h"
RobertoO 0:67c50348f842 5 //#include "BiQuad.h"
RobertoO 1:b862262a9d14 6 //#include "FastPWM.h"
RobertoO 0:67c50348f842 7
RobertoO 0:67c50348f842 8
RobertoO 1:b862262a9d14 9 MODSERIAL pc(USBTX, USBRX);
sanou8 2:3feeeb434275 10 InterruptIn button(SW3);
sanou8 2:3feeeb434275 11
sanou8 2:3feeeb434275 12 Ticker motor;
sanou8 2:3feeeb434275 13 volatile int counts;
sanou8 2:3feeeb434275 14 void readencoder()
sanou8 2:3feeeb434275 15 {
sanou8 2:3feeeb434275 16 QEI Encoder(D12,D13,NC,32);
sanou8 2:3feeeb434275 17 counts = Encoder.getPulses();
sanou8 2:3feeeb434275 18 }
sanou8 2:3feeeb434275 19 void print()
sanou8 2:3feeeb434275 20 {
sanou8 2:3feeeb434275 21 pc.printf("%i",counts);
sanou8 2:3feeeb434275 22 }
RobertoO 0:67c50348f842 23
RobertoO 0:67c50348f842 24 int main()
RobertoO 0:67c50348f842 25 {
sanou8 2:3feeeb434275 26 button.mode(PullUp);
RobertoO 0:67c50348f842 27 pc.baud(115200);
sanou8 2:3feeeb434275 28 button.rise(print);
sanou8 2:3feeeb434275 29 motor.attach(readencoder, 0.002);
sanou8 2:3feeeb434275 30 while (true)
sanou8 2:3feeeb434275 31 {
RobertoO 0:67c50348f842 32 }
sanou8 2:3feeeb434275 33 }