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.
main.cpp
00001 #include "mbed.h" 00002 #include "HIDScope.h" 00003 00004 // Define the HIDScope and Ticker object 00005 HIDScope scope(1); 00006 Ticker scopeTimer; 00007 00008 // Read the analog input 00009 AnalogIn a0(A0); 00010 00011 // Set LED out 00012 DigitalOut led(LED_RED); 00013 00014 const float kTimeLedToggle = .5f; // period of blinking 00015 const int kLedOn=0; // Led on if 0 00016 00017 // The data read and send function 00018 void scopeSend() 00019 { 00020 scope.set(0, a0.read()); 00021 scope.send(); 00022 } 00023 00024 void SwitchLed(){ 00025 led = not led; 00026 } 00027 00028 int main() 00029 { 00030 led = not kLedOn; 00031 00032 // Create ticker for LED and attach 00033 Ticker tick_toggle_led; 00034 tick_toggle_led.attach(SwitchLed,kTimeLedToggle); 00035 00036 // Attach the data read and send function at 100 Hz 00037 scopeTimer.attach(scopeSend, 1e4); 00038 00039 while(true); 00040 }
Generated on Sun Jul 17 2022 16:29:09 by
1.7.2