C# Button Click for UART COM
-
Ok I have setup a simple gui for uart. I am trying to light up 4 LEDS thru a MC. LED0 will be 0x01, LED 1, 2, 3 will be 2, 4, 8. Will this send out the appropriate command I am looking for. This will have to be sent out through TxD. I have no way to test it until tomorrow because I do not have the hardware with me but was wondering if this would suffice. I do not get any errors or warnings so I am thinking it should. Thanks
#region Buttons
private void buttonLED0\_Click\_1(object sender, EventArgs e) { Data = Data ^= 0x01; int BytesToWrite = Data; int bytes = serialPort1.BytesToWrite; //UInt32 numBytesWritten = 1; buttonLED0.Enabled = !buttonLED0.Enabled; if (buttonLED0.Enabled) { pictureBoxLED0.BackgroundImage = imageList1.Images\[(int)LEDColor.GreenOn\]; } if (!buttonLED0.Enabled) { pictureBoxLED0.BackgroundImage = imageList1.Images\[(int)LEDColor.RedOn\]; } }
-
Ok I have setup a simple gui for uart. I am trying to light up 4 LEDS thru a MC. LED0 will be 0x01, LED 1, 2, 3 will be 2, 4, 8. Will this send out the appropriate command I am looking for. This will have to be sent out through TxD. I have no way to test it until tomorrow because I do not have the hardware with me but was wondering if this would suffice. I do not get any errors or warnings so I am thinking it should. Thanks
#region Buttons
private void buttonLED0\_Click\_1(object sender, EventArgs e) { Data = Data ^= 0x01; int BytesToWrite = Data; int bytes = serialPort1.BytesToWrite; //UInt32 numBytesWritten = 1; buttonLED0.Enabled = !buttonLED0.Enabled; if (buttonLED0.Enabled) { pictureBoxLED0.BackgroundImage = imageList1.Images\[(int)LEDColor.GreenOn\]; } if (!buttonLED0.Enabled) { pictureBoxLED0.BackgroundImage = imageList1.Images\[(int)LEDColor.RedOn\]; } }
You're in the wrong forum. COM here stands for Component Object Model and not serial port.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)