Hi
I am using the following libraries and I am trying to get them working on an arduino mega
I am unsure how the pins would be mapped.
The code worked on anything with an ATMega328
the code to use the library is;
#include <Wire.h>
#include <Ports.h>
#include <PortsSHT21.h>
#include <SHT2x.h>//Define soft i2c channels for 3 sensors
SHT21 hsensor2 (2); // pins A1 and D5 - Sensor 2
SHT21 hsensor3 (3); // pins A2 and D6 - Sensor 3
SHT21 hsensor4 (4); // pins A3 and D7 - Sensor 4//define variables for temp data
float h, t;void setup()
{
Wire.begin();
Serial.begin(9600);
}void loop()
{
// Get data from first sensor hard I2C channel
float hum1 = (SHT2x.GetHumidity());
float temp1 = (SHT2x.GetTemperature());
Serial.println("temp1");
Serial.println(temp1);// Get data from second sensor soft I2C
hsensor2.measure(SHT21::HUMI);
hsensor2.measure(SHT21::TEMP);
hsensor2.calculate(h, t);
float hum2 = (h);
float temp2 = (t);
Serial.println("temp2");
Serial.println(temp2);// Get data from third sensor soft I2C
hsensor3.measure(SHT21::HUMI);
hsensor3.measure(SHT21::TEMP);
hsensor3.calculate(h, t);
float hum3 = (h);
float temp3 = (t);
Serial.println("temp3");
Serial.println(temp3);// Get data from fourth sensor soft I2C
hsensor4.measure(SHT21::HUMI);
hsensor4.measure(SHT21::TEMP);
hsensor4.calculate(h, t);
float hum4 = (h);
float temp4 = (t);
Serial.println("temp4");
Serial.println(temp4);
Serial.println("");
Serial.println("");
delay(500);
}