Brittany Bull
Published © MIT

Easy Peasy Temperature Monitor

Get temperature data on your serial monitor with minimal effort setup using the XinaBox ☒CHIPS.

BeginnerFull instructions provided5 minutes658
Easy Peasy Temperature Monitor

Things used in this project

Hardware components

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

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Temperature Serial print

Arduino
Code for showing temperature data received from the XChip SW01 in the serial monitor of Arduino IDE.
#include <xCore.h>
#include <xSW01.h>


// Create a variable for the storage of data received from SW01  
  float Celsius_Temp;
  float Farenheit_Temp;

  
const int DELAY_TIME = 1000;

xSW01 SW01;

void setup() {
  // Start the Serial Monitor
  Serial.begin(115200);

  // START I2C COMMUNICATION
  Wire.begin();
  
  // Start the SW01
  SW01.begin();

  //Intialising variables
  Celsius_Temp = Farenheit_Temp = 0;
  
  Serial.println("     Temperature Project        ");
  Serial.println("================================");
  
  //Delay for sensor to normalise
  delay(3000);
}

void loop() {
  
  // Read and calculate data from SW01 sensor
  SW01.poll();
  
  // Request the temperature measurement from SW01 and store in
  // the temperature variable   
  Celsius_Temp = SW01.getTempC(); // Temperature in Celcuis
   Farenheit_Temp = SW01.getTempF(); // Temperature in Farenheit
  
  // Show data over the Serial Monitor   
  Serial.print("Celsius_Temp: ");
  Serial.print(Celsius_Temp);
  Serial.println(" C");
  Serial.print("Farenheit_Temp: ");
  Serial.print(Farenheit_Temp);
  Serial.println(" F"); 

  // Small delay between sensor reads
  delay(DELAY_TIME);
}

Credits

Brittany Bull

Brittany Bull

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

Comments