Application example¶
The application is prepared for the Ckicket board, whose information could be find in the Hackaday page and the Tindie page where you can acquire it and it is used in the application employed in this project.
The main application is an Arduino File, an it has the structure and the compilation process according to the Arduino framework.
1. Application structure¶
As every Arduino application the program has two main parts which acquire
void setup()
and void loop()
.
On the other hand, to use the library is requiered to create the
object corresponding to the SensorTlera
class.
An example usign the BME280 sensor, could have the following structure:
#include "SensorsTlera.h"
#include "sensor_config.h"
SensorTlera Sensors;
BME280_t bme280_value;
void setup()
{
Sensors.initialize_board();
Sensors.initialize_BME280();
delay(1000);
Sensors.callibrate_BME280();
}
void loop()
{
bme280_value = Sensors.readSensors_BME280();
Serial.println((String)bme280_value);
delay(5000);
}
2. Uploading application¶
To upload the script to the corresponding board, it is requiered to follow the next steps:
2.1. Check hardware setup¶
The Long-Cricket board has some onboard sensors, which corresponds to BMA400, BME280 and GNSS. On the other hand, you can add external sensors such as ADXL345, L3G4200D y HMC5883L.
Before to connect and attempt to upload the program you should check the connections of external sensors and that they do not generate any conflict with onboard sensors.
2.2. Check software configuration¶
It is required that sensors have configured correctly, so there should be a corresponding list of libraries and configuration files accompanying them.
Recommended files are considered in Configuration files, which provides also a configuration example.
After checked the files your should verify the code in software, for this reason you could follow the next steps:
Pressing
F1
, to open the commands pallete.Select the
Arduino:Verify
or viaCtrl+Alt+R
Verify that it has no errors, showing a message similar as:
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
Sketch uses 121984 bytes (62%) of program storage space. Maximum is 196608 bytes.
Global variables use 8712 bytes (42%) of dynamic memory, leaving 11768 bytes for local variables. Maximum is 20480 bytes.
2.3. Upload the software¶
Once verified that there is no errors, you could connect the board to the computer and then:
Pressing
F1
, to open the commands pallete.Select the
Arduino:Upload
or viaCtrl+Alt+U
.The board should be flashed.