I'm trying to write a byte array to serial, but am getting the following error:
error: no matching function for call to 'Serial_::write(byte [22], int)'
Regardless of what format the array takes (uint8_t, char etc) , I can't seem to see a matching function candidate.
This format seems to be valid per the documentation at: Serial.write() - Arduino Reference (3rd syntax option)
However looking through the HardwareSerial.h, it doesn't look like there is a version of the write function that takes more than 1 argument. Has this form of serial write been deprecated or am I missing something?
Using IDE 1.0.5.
/Applications/Arduino 1.0.5.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.cpp
/* default implementation: may be overridden */
size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while (size--) {
n += write(*buffer++);
}
return n;
}
Try casting the array as a pointer:
Serial.write((uint8_t *)buffer, (size_t) size); {/code]
Ahh, that got me looking in the write place.
I'm using a LeoStick (LeoStick (Arduino Compatible) | Freetronics) and I didn't even consider this as a source of the problem. A quick look in USBAPI.h showed that it hadn't pulled in the write function from Print:
using Print::write;
Was missing.
Added this back in and away it went.
Cheers!