X10 Server - IOT device to leverage a collection of old X10 devices for home automation and lighting control.

Dependencies:   IniManager mbed HTTPClient SWUpdate mbed-rtos Watchdog X10 SW_HTTPServer SW_String EthernetInterface TimeInterface SSDP

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SignOfLife.cpp Source File

SignOfLife.cpp

00001 
00002 #include "SignOfLife.h"
00003 
00004 static PwmOut signOfLife[4] = {LED1, LED2, LED3, LED4};
00005 
00006 /// ShowSignOfLife
00007 ///
00008 /// Pulse an LED to indicate a sign of life of the program.
00009 /// This also has some moderate entertainment value.
00010 ///
00011 void ShowSignOfLife(int which)
00012 {
00013 #define PI 3.14159265359
00014     static int degrees[4];
00015     float v;
00016     which %= 4; // 0-3: LED1-4
00017 
00018     degrees[which] += 5;
00019     v = sin(degrees[which] * PI / 180)/2 + 0.5;
00020     signOfLife[which] = v;     // a little dimmer
00021 }
00022