Created
August 13, 2017 03:17
-
-
Save CristianoRC/f76954e79354826d4ecb47907a70831b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.IO.Ports; | |
namespace DesenhoArduino | |
{ | |
class MainClass | |
{ | |
public static void Main(string[] args) | |
{ | |
Console.Clear(); | |
using (var comunicacao = new SerialPort("/dev/ttyACM0", 9600)) | |
{ | |
comunicacao.Open(); | |
Console.WriteLine("\n\n\n\n \t\t\t\tControle de cores no console \n\n\n\n\n\n"); | |
while (true) | |
{ | |
var saida = comunicacao.ReadLine(); | |
if (saida.Contains("Botao verde pressionado!")) | |
{ | |
Console.BackgroundColor = ConsoleColor.DarkGreen; | |
Console.Write(" "); | |
} | |
else | |
{ | |
Console.BackgroundColor = ConsoleColor.DarkRed; | |
Console.Write("\n"); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment