make sure serial port is selected
This commit is contained in:
parent
fa3270056d
commit
66afcad064
1 changed files with 11 additions and 1 deletions
|
@ -79,6 +79,11 @@ namespace PinkConnection2_TestApp
|
|||
|
||||
void sendFrame()
|
||||
{
|
||||
if (port == null)
|
||||
{
|
||||
MessageBox.Show("Please select a serial port");
|
||||
return;
|
||||
}
|
||||
byte byte1 = (byte)(64 | ((b & 8) | (b & 4) | (b & 2) | (b & 1)));
|
||||
byte byte2 = (byte)(64 | (((b & 128) | (b & 64) | (b & 32) | (b & 16)) >> 4));
|
||||
port.Write(((char)byte1).ToString());
|
||||
|
@ -89,7 +94,12 @@ namespace PinkConnection2_TestApp
|
|||
{
|
||||
if (CommandTextBox.Text.Length != 2)
|
||||
{
|
||||
MessageBox.Show("Command Length must not be less than 2");
|
||||
MessageBox.Show("Command length must not be less than 2");
|
||||
return;
|
||||
}
|
||||
if (port == null)
|
||||
{
|
||||
MessageBox.Show("Please select a serial port");
|
||||
return;
|
||||
}
|
||||
port.Write(CommandTextBox.Text);
|
||||
|
|
Loading…
Add table
Reference in a new issue