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: mbed
Fork of frdm_Click_Relay_Example by
main.cpp@1:665830412d05, 2016-04-26 (annotated)
- Committer:
- GregC
- Date:
- Tue Apr 26 16:51:48 2016 +0000
- Revision:
- 1:665830412d05
- Parent:
- 0:3b9b4fce896e
Mikroe Click Relay module demo for NXP Freedom boards (tested on FRDM-K64F)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| GregC | 0:3b9b4fce896e | 1 | #include "mbed.h" |
| GregC | 0:3b9b4fce896e | 2 | |
| GregC | 1:665830412d05 | 3 | DigitalOut relay1(D6); |
| GregC | 0:3b9b4fce896e | 4 | InterruptIn sw2(SW2); |
| GregC | 0:3b9b4fce896e | 5 | |
| GregC | 1:665830412d05 | 6 | DigitalOut relay2(D10); |
| GregC | 1:665830412d05 | 7 | InterruptIn sw3(SW3); |
| GregC | 1:665830412d05 | 8 | |
| GregC | 0:3b9b4fce896e | 9 | void sw2_release(void) |
| GregC | 0:3b9b4fce896e | 10 | { |
| GregC | 1:665830412d05 | 11 | relay1 = !relay1; |
| GregC | 1:665830412d05 | 12 | } |
| GregC | 1:665830412d05 | 13 | |
| GregC | 1:665830412d05 | 14 | void sw3_release(void) |
| GregC | 1:665830412d05 | 15 | { |
| GregC | 1:665830412d05 | 16 | relay2 = !relay2; |
| GregC | 0:3b9b4fce896e | 17 | } |
| GregC | 0:3b9b4fce896e | 18 | |
| GregC | 0:3b9b4fce896e | 19 | int main() |
| GregC | 0:3b9b4fce896e | 20 | { |
| GregC | 0:3b9b4fce896e | 21 | sw2.rise(&sw2_release); |
| GregC | 1:665830412d05 | 22 | sw3.rise(&sw3_release); |
| GregC | 0:3b9b4fce896e | 23 | while (true) { |
| GregC | 0:3b9b4fce896e | 24 | } |
| GregC | 0:3b9b4fce896e | 25 | } |
