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: HIDScope MODSERIAL mbed
Fork of Signal Filter by
main.cpp
- Committer:
- Peasofcake
- Date:
- 2015-09-09
- Revision:
- 1:f6110f80fa45
- Parent:
- 0:c8a6e00fbdc3
- Child:
- 2:e30dbfec6d1e
File content as of revision 1:f6110f80fa45:
#include "mbed.h" #include "MODSERIAL.h" #include "HIDScope.h" DigitalOut r_led(LED_RED); DigitalOut g_led(LED_GREEN); DigitalOut b_led(LED_BLUE); DigitalIn button(PTA4); MODSERIAL pc(USBTX, USBRX); const int baudrate = 115200; //const int ms_wait = 100; // Define the HIDScope and Ticker objects HIDScope scope(2); Ticker scopeTimer; Ticker controllerTimer; const float period_led = 0.2; // Two analog inputs to read from AnalogIn a0(p2); AnalogIn a1(p3); void controlAndMeasure() { // Do some control // ** control code here ** // Store values in the scope scope.set(0,a0.read()); scope.set(1,a1.read()); } int main() { // Attach the HIDScope::send method from the scope object to the timer at 50Hz scopeTimer.attach_us(&scope, &HIDScope::send, 2e4); // Attach the controlAndMeasure method to the controller timer at 1kHz controllerTimer.attach_us(&controlAndMeasure, 1e3); while(1) { } }