11:42 am
August 30, 2016
Hi All,
I'm trying to port a library that init and read a IMU board. The library works well on Arduino IDE (check my arduino test example).
But when I try to verify it in Arduino compiler there's error. I uploaded my complete folder containing the two function to port : init and read.
What's wrong with my vilib ?
Thanks
12:29 pm
August 30, 2016
7:59 am
August 30, 2016
Hi,
it doesn't work. If I checked the arduino code example in Arduino IDE and the arduino code given in the compiler, it's exactly the same:
Arduino example in arduino IDE (that compiling):
#include <IMU.h>
IMU exampleIMU;
float roll3;
float pitch3;
float yaw3;
int accx;
int accy;
int accz;
void setup() {
exampleIMU.init();
}
void loop() {
exampleIMU.read(roll3, pitch3, yaw3, accx, accy, accz);
}
Arduino code given in the compiler:
#include "LVArray.h"
#include "A4Lhelper.h"
#include "IMU.h"
#include "Arduino.h"
#include "Wire.h"
#include "L3G.h"
#include "LSM303.h"
IMU exampleIMU;
void setup()
{
signed long accz4_483;
signed long accy4_424;
signed long accx4_365;
float yaw4_306;
float pitch4_254;
float roll4_105;
boolean Const609;
exampleIMU.init();
signed long LoopCounter570 = 0;
boolean LoopEnd609 = false;
do
{
accz4_483 = 0;
accy4_424 = 0;
accx4_365 = 0;
yaw4_306 = 0.000000;
pitch4_254 = 0.000000;
roll4_105 = 0.000000;
Const609 = false;
exampleIMU.read(roll4_105,pitch4_254,yaw4_306,accx4_365,accy4_424,accz4_483);
if(Const609)
{
break;
}
LoopCounter570=LoopCounter570+1;
} while(1);
}
void loop()
{
}
But I get these errors when compiling:
1.0.0.21, Arduino Due (Programming Port)
Chargement de la configuration
Initialisation des paquets...
Préparation des cartes
Vérification...
C:\Users\Admin\AppData\Local\Temp\58e9973bb6e2e908c6c199f5a9d39075.tmp\temp\temp.ino: In function 'void setup()':
temp:32: error: no matching function for call to 'IMU::read(float&, float&, float&, long int&, long int&, long int&)'
exampleIMU.read(roll4_105,pitch4_254,yaw4_306,accx4_365,accy4_424,accz4_483);
^
C:\Users\Admin\AppData\Local\Temp\58e9973bb6e2e908c6c199f5a9d39075.tmp\temp\temp.ino:32:84: note: candidate is:
In file included from C:\Users\Admin\AppData\Local\Temp\58e9973bb6e2e908c6c199f5a9d39075.tmp\temp\temp.ino:3:0:
C:\Users\Admin\Documents\Arduino\libraries\IMU/IMU.h:13:7: note: void IMU::read(float&, float&, float&, int&, int&, int&)
void read(float &roll2, float &pitch2, float &yaw2, int &accx2,int &accy2,int &accz2);
^
C:\Users\Admin\Documents\Arduino\libraries\IMU/IMU.h:13:7: note: no known conversion for argument 4 from 'long int' to 'int&'
exit status 1
no matching function for call to 'IMU::read(float&, float&, float&, long int&, long int&, long int&)'
Thank you
8:43 pm
March 12, 2015
It is because your library uses the int datatype for these parameters where the Compiler uses short for I16 and long for I32 because int can mean different things on different Arduino platforms. But you can see the code conversion so you just need to do some C casting in your translator or make modifications to the library if necessary. This is outside the scope of normal support so you will have to determine the best way to integrate with 3rd party libraries.
26
1 Guest(s)