sketch_dec09a.cpp: In function 'void setup()':
sketch_dec09a:5: error: invalid conversion from 'byte*' to 'char*'
sketch_dec09a:5: error: initializing argument 1 of 'size_t Stream::readBytes(char*, size_t)')
whats up with that? how would I get it to work with an array of bytes instead of chars?
thanks
The reason that the documentation mentions both byte and char is because they are the same size. The function is declared to take on, not overloaded to take either one.
So, if it expects char *, and you have byte *, lie to it. Tell it you have a char *. With a cast, of course.
I guess I could lie to it, it only happens in about a dozen places in my code, just kind of crappy that it says it will accept a byte when it wont .. might as well put boolean in there as well, since its 8 bits wide in avrgcc too (since we dont care to accurately document our functions around here)
Osgeld:
I guess I could lie to it, it only happens in about a dozen places in my code, just kind of crappy that it says it will accept a byte when it wont .. might as well put boolean in there as well, since its 8 bits wide in avrgcc too (since we dont care to accurately document our functions around here)
ok thanks
I agree:
Serial.readBytes(buffer, length)
buffer: the buffer to store the bytes in (char[] or byte[])
length : the number of bytes to read (int)
They should have just named it Serial.readChars(buffer, length) instead.
Stupid software guys are stupid.