relay exmaples

Fork of Hexi_Click_Relay_Example by Hexiwear

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?

UserRevisionLine numberNew 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