Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp
00001 #include "mbed.h" 00002 //#include "HIDScope.h" 00003 #include "QEI.h" 00004 #include "MODSERIAL.h" 00005 //#include "BiQuad.h" 00006 //#include "FastPWM.h" 00007 00008 00009 MODSERIAL pc(USBTX, USBRX); 00010 InterruptIn button(SW3); 00011 00012 Ticker motor; 00013 volatile int counts; 00014 void readencoder() 00015 { 00016 QEI Encoder(D12,D13,NC,32); 00017 counts = Encoder.getPulses(); 00018 } 00019 void print() 00020 { 00021 pc.printf("%i",counts); 00022 } 00023 00024 int main() 00025 { 00026 button.mode(PullUp); 00027 pc.baud(115200); 00028 button.rise(print); 00029 motor.attach(readencoder, 0.002); 00030 while (true) 00031 { 00032 } 00033 }
Generated on Wed Dec 7 2022 23:24:36 by
