EMG project for Biorobotics, works with 2 EMG inputs
Fork of HIDScope by
Diff: HIDScope.h
- Revision:
- 2:9c9226db4fb1
- Parent:
- 1:e44574634162
--- a/HIDScope.h Mon Sep 08 09:38:36 2014 +0000 +++ b/HIDScope.h Wed May 20 09:32:40 2015 +0000 @@ -6,25 +6,30 @@ /** A simple HID (Human Interface Device) scope * - Up to 6 channels of float data is transmitted in a single HID message (64 byte) - * - Theoretical maximum samplerate of 1kHz - * - Data can be parsed using a client-side server like NodeJS + * - Theoretical maximum samplerate of 1kHz (due to HID specifications) + * - Data can be parsed using a client-side server + * + * See the following repository for PC software: https://bitbucket.org/tomlankhorst/hidscope * * Example: * @code * #include "mbed.h" - * #include "HIDScope.h" + * #include "HIDScope.h" // Require the HIDScope library * - * HIDScope scope(2); - * Ticker scopeTimer; + * HIDScope scope(2); // Instantize a 2-channel HIDScope object + * Ticker scopeTimer; // Instantize the timer for sending data to the PC * - * AnalogIn a0(A0); + * AnalogIn a0(A0); // Using an analog input to obtain data * * int main() * { * - * scopeTimer.attach_us(&scope, &HIDScope::send, 1e4); // Send data at 100 Hz + * // Attach the HIDScope::send function to the timer at a 10.000 us interval (100 Hz) + * scopeTimer.attach_us(&scope, &HIDScope::send, 1e4); * - * while(1){ // Generate some data + * // 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);