Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 9


Here are some examples:

 Dim dataToSend1 As Char = CChar("A")
streamWriter1.WriteLine(dataToSend1)


Dim dataToSend2 As Int32 = 254
streamWriter1.WriteLine(dataToSend2)

Dim dataToSend3 As Decimal = 100
streamWriter1.WriteLine(dataToSend3)

Dim dataToSend4 As Boolean = True
streamWriter1.WriteLine(dataToSend4)

Dim dataToSend5 As Byte = 57
streamWriter1.WriteLine(dataToSend5.ToString)

streamWriter1.WriteLine("{0:t}", DateTime.Now)

 Char dataToSend1 = 'A';
streamWriter1.WriteLine(dataToSend1);


Int32 dataToSend2 = 254;
streamWriter1.WriteLine(dataToSend2);

Decimal dataToSend3 = 100;
streamWriter1.WriteLine(dataToSend3);

Boolean dataToSend4 = true;
streamWriter1.WriteLine(dataToSend4);

Byte dataToSend5 = 57;
streamWriter1.WriteLine(dataToSend5.ToString ());

streamWriter1.WriteLine("{0:t}", DateTime.Now);
The code above writes the following text to the stream and port:
A
254
100
True
57
4:07 PM
Free download pdf