Serial Port - Sending data as uint8

I am currently on a project and trying to send data through an Xbee. I used the SerialPort.h library to send 'H' and 'L' via the serial port to an Arduino to turn on a led. It worked. This I tried in Arduino and then in Visual Studio. Both worked.

But my final goal is to send data through serial port as uint8. But I don't know how to send data as uint8. The libraries usually use char for writing on the port.

Thank you in advance. Sorry if it sounds as a newbie question.

Upvotes: 2

Views: 1341

Answers (1)

janm
janm

Reputation: 18349

A uint8 is an eight-bit unsigned value, while a char can be signed or unsigned, but is still an eight bit byte. For serial communications you can sent the uint8 using the char interface. The only special thing might be a cast when sending the data You will need to know from context what you are receiving and perform the reverse operation.

Upvotes: 1

Related Questions