Hi! I'm trying to use Bluetooth with Serial.readBytes, but I got this error.
exit status 1
no matching function for call to 'HardwareSerial::readBytes(int [5], int)'
My code is this
if(Serial.available() > 0) {
Serial.readBytes(dataList, 5);
for(byte i = 0; i < 4; i++) {
Serial.println(dataList[i]);
}
Please help me solving this error
Thank you.
J-M-L
2
try to define you dataList
array as
byte dataList[5];
not int
side note 1: you check if 1 byte is available and then try to read 5. you might get caught by timeout.
side note2: Don't post snippets (Snippets R Us!)
The error means the compiler can not find a version of the readBytes function that matches the types of the parameters you give.
Oh, I changed int to byte, and it really works! Thanks, and it was the first time using the forum so sorry for the snippets .
J-M-L
5
Glad it helped !
Have fun
system
Closed
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.