我正在尝试使用this六轴互补过滤器库来解释LSM6DS3 motion sensor中的数据。
在我的Arduino草图中调用它,出现此错误。抱歉,您的问题很愚蠢,我才刚开始学习以下内容:
#include "SparkFunLSM6DS3.h"
#include "Wire.h"
#include "SPI.h"
#include "six_axis_comp_filter.h"
LSM6DS3 myIMU; // Constructor for the motion sensor (this works)
CompSixAxis test; // this breaks
当我尝试初始化CompSixAxis类的实例时,出现以下错误:
没有匹配的函数来调用'CompSixAxis :: CompSixAxis()'
最佳答案
类CompSixAxis
没有默认的构造函数。这意味着您不能像
CompSixAxis test;
因为这需要默认的构造函数。为了构造对象,您将需要使用具有以下形式的构造函数
CompSixAxis(float deltaTime, float tau);
所以您更新的代码看起来像
CompSixAxis test(some_value, some_other_value);
关于c++ - 在Arduino中初始化C++库,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36579735/