Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Form1()
- {
- InitializeComponent();
- SerialPort1 = new SerialPort();
- SerialPort1.PortName = "COM3";
- SerialPort1.BaudRate = 9600;
- btnLigaLED.BackColor = Color.White;
- btnDesligaLED.BackColor = Color.White;
- }
- private void BtnLigaLED_Click(object sender, EventArgs e)
- {
- SerialPort1.Open();
- if (SerialPort1.IsOpen)
- {
- SerialPort1.WriteLine("1");
- }
- SerialPort1.Close();
- btnLigaLED.BackColor = Color.Aqua;
- btnDesligaLED.BackColor = Color.White;
- }
- private void BtnDesligaLED_Click(object sender, EventArgs e)
- {
- SerialPort1.Open();
- if (SerialPort1.IsOpen)
- {
- SerialPort1.WriteLine("0");
- }
- SerialPort1.Close();
- btnDesligaLED.BackColor = Color.Aqua;
- btnLigaLED.BackColor = Color.White;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement