Created
November 10, 2014 17:10
-
-
Save Grabacr07/7a5a18fd7ad091feb8bc to your computer and use it in GitHub Desktop.
Blync を光らせて遊ぶ (コンソールから (テスト))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var controller = new BlyncLightController(); | |
var numberOfDevices = controller.InitBlyncDevices(); | |
if (numberOfDevices == 0) return; | |
try | |
{ | |
var color = 0; | |
while (true) | |
{ | |
var input = Console.ReadLine(); | |
if (input == "exit") break; | |
if (input == "blink-fast") | |
{ | |
controller.Blink((BlyncLightController.Color)color, BlyncLightController.Speed.Fast, 0); | |
continue; | |
} | |
if (input == "blink-slow") | |
{ | |
controller.Blink((BlyncLightController.Color)color, BlyncLightController.Speed.Slow, 0); | |
continue; | |
} | |
if (int.TryParse(input, out color)) | |
{ | |
controller.Display((BlyncLightController.Color)color, 0); | |
} | |
} | |
} | |
finally | |
{ | |
controller.CloseDevices(numberOfDevices); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment