groep 16 / Mbed 2 deprecated template_encoder_test

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

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 }