tara-irvine
1/8/2018 - 4:59 PM

SAM labs Smartwatch

"use strict";

t = Date.call('now').match(/\w* \w* \w* \d* (\d+):(\d+)/);

//Commend this line out

//to save you project. un commend when you want to work with it again.

var hours = parseInt(t[1], 10); //Hours

if(hours>12){hours=hours-12;} //if above 12 hours, subtract 12

var minutes = parseInt(t[2], 10); //Minutes

var FIVEminutes = minutes / 5;

if(Switch0 != 1)

{

for(var e = 0; e < hours; e++)

{

CM.sendTo("RGBLED0", [100,0,0], 500+(1000*e));

CM.sendTo("RGBLED0",[0,0,0], 1000+(1000*e));

}

for(var i = 0; i < FIVEminutes; i++)

{

CM.sendTo("RGBLED0", [0,0,100], 500+(1000*i)+(1000*hours));

CM.sendTo("RGBLED0",[0,0,0], 1000+(1000*i)+(1000*hours));

}

}