relay exmaples

Fork of Hexi_Click_Relay_Example by Hexiwear

Committer:
maclobski
Date:
Thu Aug 25 16:45:46 2016 +0000
Revision:
1:489e49494755
Parent:
0:b492a09a523e
changed to slot 2;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregC 0:b492a09a523e 1 #include "mbed.h"
GregC 0:b492a09a523e 2
maclobski 1:489e49494755 3 DigitalOut relay1(PTA11);
maclobski 1:489e49494755 4 DigitalOut relay2(PTC3);
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