Hallo,
Ich versuche Momentan eine IMU anzusteuern bzw. auszulesen die per I2C
an meinen Raspberry angeschlossen ist. Die Testprogramme funktionieren,
nun wollte ich das ganze in mein C++ (in QT) einfügen, jedoch bekomme
ich folgende Fehler. Die RTIMULIB wird gefunden, denn wenn ich den
include auskommentiere gibt er mir "xx was not declared in this scope"
fehler aus.
anbei meinen Code. Die Library findet man hier:
https://github.com/RPi-Distro/RTIMULib
Herausgenommen habe ich den unteren Codeschnipsel aus dem
Linux/RTIMULibDrive10 beispiel.
1 | #include <QApplication>
|
2 | #include <QQmlApplicationEngine>
|
3 | #include <QGraphicsObject>
|
4 | #include <QQmlEngine>
|
5 | #include <QtQml>
|
6 |
|
7 | #include <QQmlContext>
|
8 | #include "mainboard.h"
|
9 | #include <QQuickStyle>
|
10 | #include "mainboard.h"
|
11 | #include "RTIMULib.h"
|
12 |
|
13 | int main(int argc, char *argv[])
|
14 | {
|
15 | QQuickStyle::setStyle("Material");
|
16 |
|
17 | QApplication app(argc, argv);
|
18 |
|
19 | QQmlApplicationEngine engine;
|
20 |
|
21 | engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
22 |
|
23 |
|
24 | RTIMUSettings *settings = new RTIMUSettings("RTIMULib");
|
25 |
|
26 | RTIMU *imu = RTIMU::createIMU(settings);
|
27 | RTPressure *pressure = RTPressure::createPressure(settings);
|
28 |
|
29 | if ((imu == NULL) || (imu->IMUType() == RTIMU_TYPE_NULL)) {
|
30 | printf("No IMU found\n");
|
31 | exit(1);
|
32 | }
|
33 | return app.exec();
|
34 | }
|
Grüße