SHARE
TWEET

Untitled

a guest May 24th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Form1()
  2.         {
  3.             InitializeComponent();
  4.             SerialPort1 = new SerialPort();
  5.             SerialPort1.PortName = "COM3";
  6.             SerialPort1.BaudRate = 9600;
  7.             btnLigaLED.BackColor = Color.White;
  8.             btnDesligaLED.BackColor = Color.White;
  9.         }
  10.  
  11.         private void BtnLigaLED_Click(object sender, EventArgs e)
  12.         {
  13.             SerialPort1.Open();
  14.             if (SerialPort1.IsOpen)
  15.             {
  16.                 SerialPort1.WriteLine("1");
  17.             }
  18.             SerialPort1.Close();
  19.             btnLigaLED.BackColor = Color.Aqua;
  20.             btnDesligaLED.BackColor = Color.White;
  21.         }
  22.  
  23.         private void BtnDesligaLED_Click(object sender, EventArgs e)
  24.         {
  25.             SerialPort1.Open();
  26.             if (SerialPort1.IsOpen)
  27.             {
  28.                 SerialPort1.WriteLine("0");
  29.             }
  30.             SerialPort1.Close();
  31.             btnDesligaLED.BackColor = Color.Aqua;
  32.             btnLigaLED.BackColor = Color.White;
  33.         }
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top