How to read unsigned char array from serial port?


#1

i have used such as

Serial4.read(response,9);

where response is an unsigned char array[9] variable

it gives error as

no matching function for call to ‘USARTSerial::read(unsigned char [9], int)’

can anybody help me


#2

USARTSerial class inherits from Stream and hence you should find something there
https://docs.particle.io/reference/firmware/photon/#stream-class


#3

i think it is readBytes() in stream

but how to declare stream class variable?


#4

Serial4 (as pointed out) is an instance inheriting from Stream class…

Serial4.readBytes(myBuffer, size);

#5

thank u i got it