Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of KX022 by
KXTJ3 Class Reference
KXTJ3 accelerometer example. More...
#include <KXTJ3.h>
Public Member Functions | |
| KXTJ3 (I2C *i2c_obj, int addr=KXTJ3_DEFAULT_SLAVE_ADDRESS) | |
| KXTJ3 constructor. | |
| ~KXTJ3 () | |
| KXTJ3 destructor. | |
| void | initialize (void) |
| Initializa KXTJ3 sensor. | |
| float | getAccX () |
| Get X axis acceleration. | |
| float | getAccY () |
| Get Y axis acceleration. | |
| float | getAccZ () |
| Get Z axis acceleration. | |
| void | getAccAllAxis (float *res) |
| Get XYZ axis acceleration. | |
Detailed Description
KXTJ3 accelerometer example.
#include "mbed.h" #include "KXTJ3.h" int main(void) { KXTJ3 acc(I2C_SDA, I2C_SCL); PwmOut rled(LED_RED); PwmOut gled(LED_GREEN); PwmOut bled(LED_BLUE); while (true) { rled = 1.0 - abs(acc.getAccX()); gled = 1.0 - abs(acc.getAccY()); bled = 1.0 - abs(acc.getAccZ()); wait(0.1); } }
Definition at line 81 of file KXTJ3.h.
Constructor & Destructor Documentation
| KXTJ3 | ( | I2C * | i2c_obj, |
| int | addr = KXTJ3_DEFAULT_SLAVE_ADDRESS |
||
| ) |
Member Function Documentation
| void getAccAllAxis | ( | float * | res ) |
| float getAccX | ( | ) |
| float getAccY | ( | ) |
| float getAccZ | ( | ) |
Generated on Thu Jul 14 2022 00:27:58 by
1.7.2
