Liebe Arduino Gemeinde,
der unten stehende Sketch wird von mir noch "ausgebaut", damit ich eine Elevatons-Messung bekomme.
Wenn's denn mal läuft.
Seit einiger Zeit hänge ich an recht hartnäckigen Fehlermeldungen:
Wasserwaage_ADXL345:14:9: error: no matching function for call to 'ADXL345::ADXL345()'
ADXL345 acc;
oder:
\Arduino\libraries\ADXL345\src/ADXL345.h:96:5: note: candidate: ADXL345::ADXL345(uint8_t, TwoWire*)
ADXL345(uint8_t i2cAddress, TwoWire *wire=&Wire);
oder:
\Arduino\libraries\ADXL345\src/ADXL345.h:96:5: note: candidate expects 2 arguments, 0 provided
oder:
\Arduino\libraries\ADXL345\src/ADXL345.h:35:7: note: candidate: constexpr ADXL345::ADXL345(const ADXL345&)
class ADXL345 {
und noch einige andere
Und hier der Code/Sketch:
#include <Wire.h>
#include <ADXL345.h>
const float alpha = 0.5;
double fXg = 0;
double fYg = 0;
double fZg = 0;
ADXL345 acc;
void setup()
{
acc.begin();
Serial.begin(9600);
delay(100);
}
void loop()
{
double pitch, roll, Xg, Yg, Zg;
acc.read(&Xg, &Yg, &Zg);
//Low Pass Filter to smooth out data
fXg = Xg * alpha + (fXg * (1.0 - alpha));
fYg = Yg * alpha + (fYg * (1.0 - alpha));
fZg = Zg * alpha + (fZg * (1.0 - alpha));
//Roll and Pitch Equations
roll = (atan2(-fYg, fZg)*180.0)/M_PI;
pitch = (atan2(fXg, sqrt(fYg*fYg + fZg*fZg))*180.0)/M_PI;
Serial.print(pitch);
Serial.print(" ");
Serial.println(roll);
delay(50);
}
Verwendet wird:
ein "UNO" (vermutlich China),
die IDE 1.8.9 (alle Bibliotheken sind aktuell)
der ADXL345 (GY-291)
und ein ratloser Mensch. ![]()
Wer kann mir hier weiterhelfen ?
Viele Grüße
AstroArduino