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.cpp@0:b12b22c76c4d, 2020-12-07 (annotated)
- Committer:
- qynx
- Date:
- Mon Dec 07 21:02:16 2020 +0000
- Revision:
- 0:b12b22c76c4d
Create library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| qynx | 0:b12b22c76c4d | 1 | #include "toggle.h" |
| qynx | 0:b12b22c76c4d | 2 | |
| qynx | 0:b12b22c76c4d | 3 | |
| qynx | 0:b12b22c76c4d | 4 | |
| qynx | 0:b12b22c76c4d | 5 | Toggle::Toggle(PinName pin) : _p(pin) |
| qynx | 0:b12b22c76c4d | 6 | { |
| qynx | 0:b12b22c76c4d | 7 | _p = 0; |
| qynx | 0:b12b22c76c4d | 8 | } |
| qynx | 0:b12b22c76c4d | 9 | |
| qynx | 0:b12b22c76c4d | 10 | void Toggle::toggle(int n) |
| qynx | 0:b12b22c76c4d | 11 | { |
| qynx | 0:b12b22c76c4d | 12 | for(int i=0; i<n*2; i++) { |
| qynx | 0:b12b22c76c4d | 13 | _p = !_p; |
| qynx | 0:b12b22c76c4d | 14 | wait(0.2); |
| qynx | 0:b12b22c76c4d | 15 | } |
| qynx | 0:b12b22c76c4d | 16 | } |