Pages: [1]   Go Down
Author Topic: no matching function for call to 'Serial_::write(byte [2],int)'  (Read 835 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Serial.write(id, 2);
When I Verify, compilation fails at this line with the following error:
Code:
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?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 209
Posts: 13016
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Does this help...

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

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does this help...

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

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50111
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the cast, try changing uint8_t to char.
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the cast, try changing uint8_t to char.

Nah, the prototype is
Code:
    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.
Logged

France
Offline Offline
Edison Member
*
Karma: 38
Posts: 1012
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello and welcome,

Try replace:

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

by:

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

Pages: [1]   Go Up
Jump to: