Post by dsweet0627 on Feb 11, 2014 22:38:28 GMT
Below a simple command line program to change the color or set the blink rate of a Blync Light.
Unfortunately, it does not work to change the blink rate; What am I missing?
--
using System;
using Blynclight;
namespace blync_cl
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: blync_cl <color>|<speed>");
return;
}
BlynclightController oBlynclightController = new BlynclightController();
int numberOfBlyncDevices = oBlynclightController.InitBlyncDevices();
if (numberOfBlyncDevices > 0)
{
bool bResult=true;
switch (args[0])
{
case "blue":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Blue);
break;
case "cyan":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Cyan);
break;
case "green":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Green);
break;
case "off":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Off);
break;
case "purple":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Purple);
break;
case "red":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Red);
break;
case "white":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.White);
break;
case "yellow":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Yellow);
break;
case "fast":
oBlynclightController.Blink(Blynclight.BlynclightController.Color.White, Blynclight.BlynclightController.Speed.Fast);
break;
case "normal":
oBlynclightController.Blink(Blynclight.BlynclightController.Color.White, Blynclight.BlynclightController.Speed.Normal);
break;
case "slow":
oBlynclightController.Blink(Blynclight.BlynclightController.Color.White, Blynclight.BlynclightController.Speed.Slow);
break;
default:
Console.WriteLine("Unknown color: {0}", args[0]);
break;
}
if (! bResult)
{
Console.WriteLine("Can not set Blnc to {0}", args[0]);
}
}
else
{
Console.WriteLine("No Blync found");
}
}
}
}
Unfortunately, it does not work to change the blink rate; What am I missing?
--
using System;
using Blynclight;
namespace blync_cl
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: blync_cl <color>|<speed>");
return;
}
BlynclightController oBlynclightController = new BlynclightController();
int numberOfBlyncDevices = oBlynclightController.InitBlyncDevices();
if (numberOfBlyncDevices > 0)
{
bool bResult=true;
switch (args[0])
{
case "blue":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Blue);
break;
case "cyan":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Cyan);
break;
case "green":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Green);
break;
case "off":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Off);
break;
case "purple":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Purple);
break;
case "red":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Red);
break;
case "white":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.White);
break;
case "yellow":
bResult = oBlynclightController.Display(Blynclight.BlynclightController.Color.Yellow);
break;
case "fast":
oBlynclightController.Blink(Blynclight.BlynclightController.Color.White, Blynclight.BlynclightController.Speed.Fast);
break;
case "normal":
oBlynclightController.Blink(Blynclight.BlynclightController.Color.White, Blynclight.BlynclightController.Speed.Normal);
break;
case "slow":
oBlynclightController.Blink(Blynclight.BlynclightController.Color.White, Blynclight.BlynclightController.Speed.Slow);
break;
default:
Console.WriteLine("Unknown color: {0}", args[0]);
break;
}
if (! bResult)
{
Console.WriteLine("Can not set Blnc to {0}", args[0]);
}
}
else
{
Console.WriteLine("No Blync found");
}
}
}
}