I’m using ADXL345 to detect free fall. I found a library in github with an example of free fall sketch. but is showing me this error: no matching function for call to ‘ADXL345::ADXL345()’
// Initialize ADXL345
Serial.println("Could not find a valid ADXL345 sensor, check wiring!");
// Values for Free Fall detection
accelerometer.setFreeFallThreshold(0.35); // Recommended 0.3 -0.6 g
accelerometer.setFreeFallDuration(0.1); // Recommended 0.1 s
// Select INT 1 for get activities
// Check settings
Serial.print("Free Fall Threshold = "); Serial.println(accelerometer.getFreeFallThreshold());
Serial.print("Free Fall Duration = "); Serial.println(accelerometer.getFreeFallDuration());
// Read values for activities
Vector norm = accelerometer.readNormalize();
// Read activities
Activites activ = accelerometer.readActivites();
Serial.println("Free Fall Detected!");
library link GitHub - jarzebski/Arduino-ADXL345: ADXL345 Triple Axis Accelerometer Arduino Library.
Does anyone have suggestions?
Thanks in advance
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn’t show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.
Post a link to where you got the library from. Please use the chain links icon on the toolbar to make it clickable.
I can't reproduce the issue. Your code compiles fine for me with that library. Are you sure you're not using a different library?
true. I tried it on another computer and it works. I will check my computer again.
Thank you for your answer was really helpful for me.
If you can't find the problem try doing this:
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.
The full output might contain information that will give me a clue to what's going on.
You forgot the code tags.
You're definitely using a different library than the one you posted a link to:
The library you linked to does not have a src folder. Instead the source files are located in the root of the library folder.
So you have two choices:
- Modify your code to be compatible with the library you are using.
- Install the library your code is written for. Note that you will need to delete C:\Users\Navaneeth\Documents\Arduino\libraries\ADXL345 so that the Arduino IDE will include the ADXL345.h file from the Arduino-ADXL345 library.