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: Encoder MODSERIAL mbed
Fork of P_controller_motor_Bouke by
Diff: main.cpp
- Revision:
- 1:b0d3c64bd4d8
- Parent:
- 0:843492f4fe62
- Child:
- 2:f5c9d981de51
--- a/main.cpp Thu Sep 17 10:08:19 2015 +0000 +++ b/main.cpp Thu Sep 17 10:12:24 2015 +0000 @@ -1,7 +1,29 @@ #include "mbed.h" #include "HIDScope.h" -//P Motor Controller +// Define the HIDScope and Ticker object +HIDScope scope(1); +Ticker scopeTimer; + +// Read the analog input +float triangle_signal = 2.05; + +// The data read and send function +void scopeSend() +{ + scope.set(0,triangle_signal); + scope.send(); +} + +int main() +{ + // Attach the data read and send function at 100 Hz + scopeTimer.attach_us(&scopeSend, 1e4); + + while(1) { } +} + +////// P Motor Controller // Controller gain const double motorP_Kp=2.5;