One Shot TPH Sample

This application demonstrates temperature, pressure, and humidity reading functions of the module. It uses Arduino IDE's Serial Monitor to display sensor readings.

To run the example:

  1. Open the IoT_Node_Environmental_One_Shot_TPH sketch from the examples menu.

  2. Select Turta IoT Node from Tools > Board menu.

  3. Select your device's COM port from Tools > Port menu.

  4. Open Serial Monitor from Tools > Serial Monitor.

  5. Select 115.200 baud from the Serial Monitor's status bar.

  6. Upload the code to your device.

Sample Code

#include <Turta_Environmental_Module.h>

// Create Environmental Sensor instance.
Turta_Environmental_Module en;

void setup() {
  // Initialize Environmental Sensor.

  // Configure serial port.

void loop() {
  // Read temperature, pressure, and humidity in one shot. 
  double temperature, pressure, humidity;
  en.readTPH(temperature, pressure, humidity);

  // Print temperature.
  Serial.print("Temperature: ");

  // Print relative humidity.
  Serial.print("Humidity: ");

  // Print pressure.
  Serial.print("Pressure: ");

  // Print an empty line.

  // Delay 5000ms = 5 seconds.


After the application is uploaded to the device, it writes current readings to the Serial Monitor every five seconds. The example output should be like this:

Temperature: 25.26
Humidity: 57.37
Pressure: 1009.65

The application runs forever until you clear it from memory.

Last updated