Main Site Documentation

Serial Port


#1

How do you send a Hex Byte like 0xFF out the Serial Port? Need Code example.


#2
  1. Declare a byte array of required size (1 in you case).
  2. Set its first element to the value (0xFF).
  3. Use Write method to send the byte array.

There are plenty of examples in documentation,wiki and forum.

http://www.tinyclr.com/support/
http://wiki.tinyclr.com/index.php?title=UART_-_PC_Communication


#3

I can’t seem to get the syntax right. The compiler complains. I have used the following for strings

byte[] buffer2 = Encoding.UTF8.GetBytes(crlf + “IRRADIANCE @ 640 nanoMeters” + crlf);
UART.Write(buffer2, 0, buffer2.Length);

but can’t get it for 0xFA .


#4

Try this:

byte[] buffer2 = new byte[]{ 0xFA };
UART.Write(buffer2, 0, buffer2.Length);

Please also use code tags or button with “101010” to format any code snippets in forum posts.


#5

TNX: Ray