#include #include SoftWire Wire(7, 6); #define DLC_address 0x29 #define sdaPin 7 #define sclPin 6 //SoftwareWire Wire2( 2, 3); #define SDA_PORT PORTD #define SCL_PORT PORTD #define SDA_PIN 7 #define SCL_PIN 6 byte _txBufferIndex [10]; int _data; int _available; byte Pstatus; byte pressureM ; byte pressure1; byte pressureL ; float tempM ; float temp1; float tempL ; float pressure; float temperature; byte buffer [6]; void setup() { Serial.begin(115200); Wire2.begin(); _data = Wire2.requestFrom(DLC_address, 7); //request for bytes of data from the given address if (Wire2.available() == 7) { _available = true; } else { _available = false; } while (_available == false) {Serial.println ("sensor reading fail"); delay(200); } Serial.println ("sensor reading ok"); delay(2000); } void loop() { // put your main code here, to run repeatedly: Wire2.beginTransmission(DLC_address); Wire2.write(0xAA); Wire2.endTransmission(); Wire2.requestFrom(DLC_address, 7); Pstatus = Wire2.read(); pressureM = Wire2.read(); //read byte pressure1 = Wire2.read(); pressureL = Wire2.read(); //read byte tempM = Wire2.read(); //read byte temp1 = Wire2.read(); tempL = Wire2.read(); //read byte pressure = ((pressureM*65536 + 256* pressure1)-8388608)*25*248.84/16777216; temperature = ((65536*tempM + 256* temp1)*150/16777216)-40; Serial.println (Pstatus); Serial.println (pressure); Serial.println (temperature); delay(500); }