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.
Dependents: HIDScope TEST Project5-Motorcontrol EMG_HIDScope_Gr6 ... more
You are viewing an older revision! See the latest version
Homepage
The HID Scope comes in handy for debugging purposes. You can easily specify which values you want to monitor, whether it are Analog inputs, filtering floats or boolean states. Please refer to this bitbucket repository for the PC scope application: https://bitbucket.org/tomlankhorst/hidscope
It is possible to see what is going on in your device live. This step by step instruction will guide you through the process and it will be easy to adjust this setup to your needs.
Using the HIDScope on your MBED¶
If there is no project you currently working on, create one first. Now simply import the HIDScope library into your project by clicking on 'Import Library' on the homepage of this library.
Include the HIDScope library in your header
include the HIDScope library
#include "HIDScope.h"
And define the HIDScope beneath your #include-s, outside of any function. The only parameter that it takes is the number of channels you would like to use. In this case we will use one channel.
define the scope
HIDScope scope(1);
Now set the data and send it over USB! This example reads and sends at 100hz the value of the analog in.
send data at 100hz
#include "mbed.h"
#include "HIDScope.h"
HIDScope scope(1);
Ticker scopeTimer;
AnalogIn a0(p2);
void scopeSend()
{
scope.set(0,a0.read());
scope.send();
}
int main()
{
scopeTimer.attach_us(&scopeSend, 1e4); // send data at 100hz
while(1)
{
}
}
If you have a control-loop running at 10kHz you certainly wouldn't want to transfer the data at 10kHz (that isn't even possible using this device). You could SET the data in the 10kHz loop and SEND the data in a 50hz loop. See the following example using 2 channels:
example using a separate send-timer
#include "mbed.h"
#include "HIDScope.h"
HIDScope scope(2);
Ticker scopeTimer;
Ticker controllerTimer;
AnalogIn a0(p2);
AnalogIn a1(p3);
void superFast()
{
scope.set(0,a0.read());
scope.set(1,a1.read());
}
int main()
{
scopeTimer.attach_us(&scope, &HIDScope::send, 2e4); // Send data @ 50hz
controllerTimer.attach_us(&superFast, 1e3); // Control at 1kHz
while(1)
{
}
}
Upload it, you are ready! (With your MBED)
Using the HID Scope software¶
The software is written in Python and currently compatible with Windows. A deprecated NodeJS version exists that is compatible with OSX and Unix but it is not supported anymore.
Usage- Windows¶
- Download the precompiled application
- Extract the ZIP-archive
- Run
hidscope-server.exe - Open the scope in your browser (http://localhost:18082/)
Alternative - Run from source¶
Alternatively the program can be run from source - Download Python 2.7 - Clone the repo - Run python server.py