|
這是用c#寫的
請自行轉換成VB,(去網路搜查)
按button1就會動
public Form1()
{
InitializeComponent();
if (serialPort.IsOpen)
{
serialPort.Close();
}
// Configure our serial port *** You'll likely need to change these for your config! ***
serialPort.PortName = "COM1";
serialPort.BaudRate = 115200;
serialPort.Parity = System.IO.Ports.Parity.None;
serialPort.DataBits = 8;
serialPort.StopBits = System.IO.Ports.StopBits.One;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
System.Console.Beep(168, 114);
serialPort.Open();
serialPort.Write("#0 P1800\r");
serialPort.Write("#1 P1800\r");
}
else
{
System.Console.Beep(48, 54);
serialPort.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
serialPort.Write("#1 P1450\r");
} |
|