Currently, my project is to get a x coordination , cX value, from a webcam connected to raspberry pi 3B+, and send it to Arduino Uno. I successfully do the action when the integer is in range 0 to 255. Can I modify my code and send a larger integer, say up to 1920 to Arduino?
Here is part of my python code on raspi side:
import serial
import struct
while True:
...
cX = 248 //I want to send a larger number
print (cX)
ser.write(struct.pack('>H', cX))
...
Here is part of my c code on Arduino:
int cX = 0;
void setup()
{
...
Serial.begin(9600);
...
}
void loop()
{
if (Serial.available())
{
cX = Serial.read();
if (cX == 248)
{
//do something
}
}
}
Any help would be greatly appreciated