michael kosinski / Mbed 2 deprecated GR-PEACH_ArduinoRelay

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 /*
00003 This demo uses the Arduino Relay Sheild from Seeed.
00004 Here is the link to the shield
00005 http://wiki.seeed.cc/Relay_Shield_v3/
00006 The Arduino pin mapping is as follows
00007 Ardino      Relay
00008 D7          relay 1
00009 D6          relay 2
00010 D5          relay 3
00011 D4          relay 4
00012 */
00013 DigitalOut relay1(D7);
00014 DigitalOut relay2(D6);
00015 DigitalOut relay3(D5);
00016 DigitalOut relay4(D4);
00017 
00018 /*
00019     Toggle the relay with a period of 
00020 */
00021 int main() {
00022     while(1) {
00023         relay1 = 1;
00024         wait(0.5); // wait 0.5 sec ( 500ms)
00025         relay1 = 0;
00026         wait(0.5); // wait 0.5 sec ( 500ms)
00027     }
00028 }