![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test voor Inverse Kinematics (afgeleid van schrift berekeningen)
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp@2:703501924009, 2019-10-18 (annotated)
- Committer:
- s1961438
- Date:
- Fri Oct 18 12:07:54 2019 +0000
- Revision:
- 2:703501924009
- Parent:
- 1:b862262a9d14
Test_InverseKinematics
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobertoO | 0:67c50348f842 | 1 | #include "mbed.h" |
s1961438 | 2:703501924009 | 2 | #include "HIDScope.h" // Require the HIDScope library |
s1961438 | 2:703501924009 | 3 | |
s1961438 | 2:703501924009 | 4 | HIDScope scope(2); // Instantize a 2-channel HIDScope object |
s1961438 | 2:703501924009 | 5 | Ticker scopeTimer; // Instantize the timer for sending data to the PC |
s1961438 | 2:703501924009 | 6 | |
s1961438 | 2:703501924009 | 7 | AnalogIn a0(A0); // Using an analog input to obtain data |
s1961438 | 2:703501924009 | 8 | |
s1961438 | 2:703501924009 | 9 | int main() |
s1961438 | 2:703501924009 | 10 | { |
s1961438 | 2:703501924009 | 11 | |
s1961438 | 2:703501924009 | 12 | // Attach the HIDScope::send function to the timer at a 10.000 us interval (100 Hz) |
s1961438 | 2:703501924009 | 13 | scopeTimer.attach_us(&scope, &HIDScope::send, 1e4); |
s1961438 | 2:703501924009 | 14 | |
s1961438 | 2:703501924009 | 15 | // Read from the analog input in an endless loop. Two channels are written each iteration. |
s1961438 | 2:703501924009 | 16 | // Note that the control loop can run at a different frequency (1 kHz in this case) |
s1961438 | 2:703501924009 | 17 | while(1){ |
s1961438 | 2:703501924009 | 18 | scope.set(0, a0.read()); |
s1961438 | 2:703501924009 | 19 | scope.set(1, a0.read()); |
s1961438 | 2:703501924009 | 20 | wait_us(1000); |
s1961438 | 2:703501924009 | 21 | }; |
s1961438 | 2:703501924009 | 22 | |
s1961438 | 2:703501924009 | 23 | } |
RobertoO | 0:67c50348f842 | 24 |