
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Choose the port name and baud rate.
//
Port name must be determined from the Device Manager.
System.IO.Ports.SerialPort port =
new
System.IO.Ports.SerialPort(
"COM4"
, 115200);
// Connect to the port.
port.Open();
// Transmit two bytes: 0x61, 0x62
port.Write(
new
byte[]{0x61, 0x62}, 0, 2);
// Wait for a byte to be received on the RX line.
int
response = port.ReadByte();
// Show the user what byte was received.
MessageBox.Show(
"Received byte: "
+ response);
// Disconnect from the port so that other programs can use it.
port.Close();
?
Pololu Orangutan SVP User’s Guide
© 2001–2019 Pololu Corporation
9. Using the TTL Serial Port
Page 37 of 43