![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test voor Inverse Kinematics (afgeleid van schrift berekeningen)
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 2:703501924009
- Parent:
- 1:b862262a9d14
diff -r b862262a9d14 -r 703501924009 main.cpp --- a/main.cpp Wed Sep 04 15:30:13 2019 +0000 +++ b/main.cpp Fri Oct 18 12:07:54 2019 +0000 @@ -1,23 +1,24 @@ #include "mbed.h" -//#include "HIDScope.h" -//#include "QEI.h" -#include "MODSERIAL.h" -//#include "BiQuad.h" -//#include "FastPWM.h" - -DigitalOut led(LED_RED); - -MODSERIAL pc(USBTX, USBRX); + #include "HIDScope.h" // Require the HIDScope library + + HIDScope scope(2); // Instantize a 2-channel HIDScope object + Ticker scopeTimer; // Instantize the timer for sending data to the PC + + AnalogIn a0(A0); // Using an analog input to obtain data + + int main() + { + + // Attach the HIDScope::send function to the timer at a 10.000 us interval (100 Hz) + scopeTimer.attach_us(&scope, &HIDScope::send, 1e4); + + // Read from the analog input in an endless loop. Two channels are written each iteration. + // Note that the control loop can run at a different frequency (1 kHz in this case) + while(1){ + scope.set(0, a0.read()); + scope.set(1, a0.read()); + wait_us(1000); + }; + + } -int main() -{ - pc.baud(115200); - pc.printf("\r\nStarting...\r\n\r\n"); - - while (true) { - - led = !led; - - wait_ms(500); - } -}