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.
Fork of Hexi_Click_Relay_Example by
main.cpp@0:b492a09a523e, 2016-08-24 (annotated)
- Committer:
- GregC
- Date:
- Wed Aug 24 22:27:49 2016 +0000
- Revision:
- 0:b492a09a523e
- Child:
- 1:489e49494755
Click Relay example for Hexiwear
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| GregC | 0:b492a09a523e | 1 | #include "mbed.h" |
| GregC | 0:b492a09a523e | 2 | |
| GregC | 0:b492a09a523e | 3 | DigitalOut relay1(PTA10); |
| GregC | 0:b492a09a523e | 4 | DigitalOut relay2(PTC4); |
| GregC | 0:b492a09a523e | 5 | |
| GregC | 0:b492a09a523e | 6 | // main() runs in its own thread in the OS |
| GregC | 0:b492a09a523e | 7 | // (note the calls to Thread::wait below for delays) |
| GregC | 0:b492a09a523e | 8 | int main() { |
| GregC | 0:b492a09a523e | 9 | while (true) { |
| GregC | 0:b492a09a523e | 10 | relay1 = 1; |
| GregC | 0:b492a09a523e | 11 | Thread::wait(500); |
| GregC | 0:b492a09a523e | 12 | relay1 = 0; |
| GregC | 0:b492a09a523e | 13 | Thread::wait(500); |
| GregC | 0:b492a09a523e | 14 | relay2 = 1; |
| GregC | 0:b492a09a523e | 15 | Thread::wait(500); |
| GregC | 0:b492a09a523e | 16 | relay2 = 0; |
| GregC | 0:b492a09a523e | 17 | Thread::wait(500); |
| GregC | 0:b492a09a523e | 18 | } |
| GregC | 0:b492a09a523e | 19 | } |
| GregC | 0:b492a09a523e | 20 |
