ldab / kxtj3-1057 Goto Github PK
View Code? Open in Web Editor NEWKXTJ3-1057 Tri-axis Digital Accelerometer - Arduino Library
License: MIT License
KXTJ3-1057 Tri-axis Digital Accelerometer - Arduino Library
License: MIT License
I see this // Detection threshold, movement duration and polarity
myIMU.intConf(123, 1, 10, HIGH);
But i don't understand.. how to use the interrupt to wake up the microcontroller?
Just a heads up that the example code and any similar code placed into a .ino sketch to define a directive within this library will not pass on to the library correctly.
If you define both LOW_POWER and HIGH_RESOLUTION in a sketch, the error in the header for KXTJ3-1057 will be thrown as expected because the header does accept the directive, and it is the header itself throwing the error. However, if you define HIGH_RESOLUTION by itself in the sketch, this definition will not be retained for KXTJ3-1057.cpp when the Arduino IDE compiles the sketch and its linked libraries. You can check this without any hardware at all by simply modifying your local copy of the library to do something that should cause the library to fail to compile if that branch of code is reached, such as removing a semicolon from the end of a line under the #ifdef HIGH_RESOLUTION context.
A good example of where and how to do this would be here in KXTJ3::applySettings:
#ifdef HIGH_RESOLUTION
dataToWrite = 0xC0
#endif
One would think that writing #define HIGH_RESOLUTION
in the sketch would cause the compilation to fail due to the missing semicolon, but it does not.
You can further prove this by breaking the 'else' part of the start-up delay check. If HIGH_RESOLUTION is defined, that 'else' should never get touched. Yet you can remove semicolons from anywhere in the HIGH_RESOLUTION section with impunity, but if you remove them from the 'else' area the compilation will fail, proving that it is compiling using the LOW_POWER definitions instead.
This appears to be an issue in the Arduino IDE, though many replies on the forums claim this is both intentional behavior and standards-compliant. I have tried several local experiments to somehow allow a definition in the sketch to be passed to the KXTJ3-1057.cpp file but was unable to find a solution short of just defining HIGH_RESOLUTION in KXTJ3-1057.h directly rather than placing the define in the sketch.
Am running the same exact code (the example code) with interrupt pin on GPIO32, but nothing's happening! Does your interrupt work?
When using 16g as accelRange
, I get minimum 1.5g, when the sensor is just flat on the table, while 8g or lower "correctly" shows a magnitude of 1.1g.
I doesn't matter what I do with sampleRate
or HIGH_RESOLUTION
/LOW_POWER
flags.
Btw same problem in version 0.1
Am I doing something wrong?
Hello all,
I am facing strange WUF WAKEUP_COUNTER behavior (let me use datasheet terminology).
Let example, set WAKEUP_COUNTER=100, according to datasheed Fig.4 need to have 100 samples above Threshould. But in my test, if only first 10 samples were above Threshould and other 90 were below Threshold, then interrupt occurs after 100 samples.
I assume that interrupt should occur when all 100 samples are above threshold.
First time I found this issue at my code and then the same result obtained at examples/UnlatchedInterrupt
So I'm using SF timers to fix it and achive neccessary result, but I'm very thankful if somebody help me to explain this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.