Go Down

Topic: no matching function for call to 'Serial_::write(byte [2],int)' (Read 903 times) previous topic - next topic

gineer

I downloaded the Razor IMU source code (https://dev.qu.tu-berlin.de/attachments/download/1226/Razor%20AHRS%20Firmware%20and%20Test%20Sketch%20v1.4.1.zip) last night from Razor AHRS. This code uses exactly the sensors I need and would solve the problem I have currently (I hope). The only problem is that on line 535 in "Razor AHRS v1.4.1\Arduino\Razor_AHRS\Razor_AHRS.pde" in the above linked zip file they have:
Code: [Select]
Serial.write(id, 2);
When I Verify, compilation fails at this line with the following error:
Code: [Select]
no matching function for call to 'Serial_::write(byte [2],int)'
I downloaded and installed Arduino 1.0.2 on a new pc and installed the drivers to Arduino Pro Micro 16MHz/5V.

I checked the arduino documentation on Serial.write (http://arduino.cc/en/Serial/Write) and it seems to be a valid command.

What am I doing wrong?

Coding Badly


Does this help...

Code: [Select]
Serial.write( (const uint8_t*)(&id[0]), 2 );

gineer

Quote

Does this help...

Code:
Code: [Select]
Serial.write( (const uint8_t*)(&id[0]), 2 );


No, this made no difference: new error:
Code: [Select]
no matching function for call to 'Serial_::write(const uint8_t*, int)'

PaulS


WizenedEE


In the cast, try changing uint8_t to char.


Nah, the prototype is
Code: [Select]
    virtual size_t write(const uint8_t *buffer, size_t size);

I think the problem is that it's 'Serial_' rather than 'Seriral'

After I uncomment one of the "build options" it compiles fine for me. I'd suggest redownloading the IDE.

guix

Hello and welcome,

Try replace:

Code: [Select]

byte id[2];
id[0] = readChar();
id[1] = readChar();
...
Serial.write(id, 2);
Serial.println();


by:

Code: [Select]

char id[3];
id[0] = readChar();
id[1] = readChar();
id[2] = '\0';
...
Serial.println(id);

Go Up