Brittany Bull
Published © MIT

Serial Barometric Pressure

Quick and easy pressure readings on the serial monitor while using XinaBox xCHIPs and Arduino IDE.

EasyFull instructions provided5 minutes68
Serial Barometric Pressure

Things used in this project

Hardware components

IP01
XinaBox IP01
×1
XinaBox CC01
×1
SW01
XinaBox SW01
×1
XC10
XinaBox XC10
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

PressureSM.ino

Arduino
Arduino code to receive Barometric Pressure readings on the serial monitor from the xCHIPs
#include <xCore.h>  //add core library
#include <xSW01.h>  //add weather sensor library

xSW01 SW01;

const int DelayTime = 500; //Defining set delay time that could be used elsewhere in the code

//Create a variable to store the data read from SW01
float pressure;

void setup(){

  //Initialise variable to zero
  pressure = 0;
  
  //Start Serial Monitor
  Serial.begin(115200);

  //Start I2C communication
  Wire.begin();

  //Start SW01 Sensor
  SW01.begin();
  
  //String intro for project
  Serial.println("XinaBox Barometric Pressure Experiment");
  Serial.println("______________________________________");

  //Delay for sensor to normalise
  delay(3000);
  
}

void loop(){
  
  //Read and calculate data from SW01
  SW01.poll();

  //Request to get humidity, temperature and dew point data then store in the variables
  pressure = SW01.getPressure();


  //Display recorded data over the Serial Monitor

  Serial.print("Pressure:");
  Serial.print(pressure);
  Serial.println("Pa ");

  delay(5000);

}

Credits

Brittany Bull

Brittany Bull

12 projects • 5 followers
A student exploring the world of coding and IoT from a beginners' perspective

Comments