the code and design is from Misenso
/*
* Read the relative humidity and temperature values from two SHT21 sensors
* with JeeLabs "Ports" library used for software I2C:
* http://cafe.jeelabs.net/sw/library_-_ports/
*
*/
#include <Ports.h>
#include "PortsSHT21.h"
SHT21 hsensor1 (1);
SHT21 hsensor2 (2);
float h, t;
void setup()
{
Serial.begin(9600);
Serial.println("Dual SHT21 Demo (softi2c)");
}
void loop()
{
// Get data from first sensor
Serial.print("Sensor1 – ");
hsensor1.measure(SHT21::HUMI);
hsensor1.measure(SHT21::TEMP);
hsensor1.calculate(h, t);
Serial.print("Humi(%RH): ");
Serial.print(h, 1);
Serial.print(" Temp(C): ");
Serial.println(t, 1);
// Get data from second sensor
Serial.print("Sensor2 – ");
hsensor2.measure(SHT21::HUMI);
hsensor2.measure(SHT21::TEMP);
hsensor2.calculate(h, t);
Serial.print("Humi(%RH): ");
Serial.print(h, 1);
Serial.print(" Temp(C): ");
Serial.println( t, 1);
Serial.println();
delay(4000);
}
http://www.misenso.com/prototyping/two-sht21-softi2c-arduino/76/
can someone break down the code and please explain what is going on?