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.
toggle.h
00001 #ifndef TOGGLE_H 00002 #define TOGGLE_H 00003 00004 #include "mbed.h" 00005 00006 00007 /** Toggle pin for debugging purposes 00008 * 00009 * Example: 00010 * @code 00011 * #include "mbed.h" 00012 * #include "toggle.h" 00013 * 00014 * Toggle pin(P1_24); 00015 * Toggle led(P1_25); 00016 * 00017 * main() 00018 * { 00019 * 00020 * while(1) { 00021 * pin.toggle(5); // toggle pin 5 times 00022 * wait(1); 00023 * led.toggle(3); // toggle led 3 times 00024 * wait(0.5); 00025 * } 00026 * 00027 * } 00028 * @endcode 00029 */ 00030 00031 00032 class Toggle 00033 { 00034 public: 00035 00036 /** 00037 * toggle constructor 00038 * 00039 * @param pin "pin" to toggle 00040 */ 00041 Toggle(PinName pin); 00042 00043 00044 /** 00045 * Command to n times toggle the pin 00046 */ 00047 00048 void toggle(int n); 00049 00050 private: 00051 00052 /** 00053 * Set the Digital out pin 00054 */ 00055 00056 DigitalOut _p; 00057 }; 00058 00059 #endif
Generated on Fri Aug 5 2022 21:23:55 by
1.7.2