A simple but very effective scope. Up to 6 channels of 32 bit float data at 1 kHz.
Dependents: HIDScope TEST Project5-Motorcontrol EMG_HIDScope_Gr6 ... more
HIDScope Class Reference
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 (due to HID specifications)
- Data can be parsed using a client-side server.
#include <HIDScope.h>
Public Member Functions | |
HIDScope (int channels, bool non_blocking=true) | |
Instantiate the HID Scope. | |
void | set (int ch, float val) |
Sets the current channel value. | |
void | set (int ch, int val) |
Sets the current channel value. | |
void | set (int ch, bool val) |
Sets the current channel value. | |
void | set (int ch, double val) |
Sets the current channel value. | |
void | send () |
Sends the channel data to the HID client. |
Detailed Description
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 (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
There seem to be some issues with newest MBED revisions. Please select revision 119 for the time being.
Example:
#include "mbed.h" #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); }; }
Definition at line 47 of file HIDScope.h.
Constructor & Destructor Documentation
HIDScope | ( | int | channels, |
bool | non_blocking = true |
||
) |
Instantiate the HID Scope.
Definition at line 3 of file HIDScope.cpp.
Member Function Documentation
void send | ( | ) |
void set | ( | int | ch, |
int | val | ||
) |
Sets the current channel value.
- Parameters:
-
ch : integer channel no (0-6) val : integer value
- Returns:
- void
Definition at line 15 of file HIDScope.cpp.
void set | ( | int | ch, |
double | val | ||
) |
Sets the current channel value.
- Parameters:
-
ch : double channel no (0-6) val : float value
- Returns:
- void
Definition at line 25 of file HIDScope.cpp.
void set | ( | int | ch, |
bool | val | ||
) |
Sets the current channel value.
- Parameters:
-
ch : integer channel no (0-6) val : boolean value
- Returns:
- void
Definition at line 20 of file HIDScope.cpp.
void set | ( | int | ch, |
float | val | ||
) |
Sets the current channel value.
- Parameters:
-
ch : integer channel no (0-6) val : float value
- Returns:
- void
Definition at line 10 of file HIDScope.cpp.
Generated on Sun Jul 17 2022 12:34:45 by 1.7.2