Use of the temperature sensor on the BMA423 chip (accelerometer)
(EN google-translate)
(PL google-translate)
|
STEP #1:
Examples that use the acceleration sensor use the acceleration() method:
void loop()
{
acceleration();
...
}
STEP #2:
Within the acceleration method in the functions.h tab, you will find:
bool res = sensor->getAccel(acc);
...which refers to the object sensor.
STEP #3:
The sensor object is created in the twatch.h tab.
You can see that it is of type BMA:
BMA *sensor;
...
sensor = watch->bma;
STEP #4:
Im Verzeichnis..
/home/fhbstud/Arduino/libraries/TTGO_TWatch_Library-1.4.3/src/drive/bma423/
...in the header file for class BMA bma.h, there is a reference to the method
...there is the method float temperature();
...This is now being tested:
Code 0-1: Examination of the functions and libraries provided.
The methods in the BMA class indicate that additional functionality is directly supported, such as the pedometer.
Sample program for reading the temperature:
|
#include "twatch.h"
#include "variables.h"
#include "functions.h"
void setup()
{
setupTWATCH();
setFont(1, 255,255,255, 255,0,0);
backlight(true);
}
void loop()
{
clear();
acceleration();
cursor(0,0);
editor(accX);
editor('\n');
editor(accY);
editor('\n');
editor(accZ);
editor('\n');
float temp = sensor->temperature();
editor(temp);
editor('\n');
delay(100);
}
Code 0-2: Sample program for reading the temperature.
Experiment
|