Hi everyone!
my goal is to make a led matrix display low res output from a webcam by sending the data via python using the pyserial library. I am very comfortable with python and wouldn't have any issues formatting the data and sending it, it's just receiving the data from serial that is confusing to me, which is because I am quite rusty with C and C++ (I only have education in C and Python)
Here is my pseudo code:
make a char array of 3 * the number of pixels //three char per pixel
//the python code might send the image as a series of each pixels color val, ex: <r0,g0,b0,r1,g1,b1,r2,b2,g2,...rn,gn,bn>
//all sent on one line, not separated by commas.
loop
count = 0
got_something = false
while serial is available
//get a byte
pre_allocated_char_array[count] = serial.read()
count ++
got_something = true
if got_something
c equivalent of 'for i in range (number of pixels)'
char color[3];
for j in range 3
color[j] = pre-allocated-array[i + j]
set pixel i to color
does this algorithm make sense before I start?