I have a CPS122 barometer on a board that i'm trying to get the temperature and pressure data from using Wire, i'm stuck, i just cant get my head around the datasheet:-
There is examples for the CPS120 but that is slightly different, has anyone used this and can they help with (be gentle i'm new to this) thanks :-
#include<Wire.h>
#define Addr 0x6D
void setup()
{
Wire.begin();
Serial.begin(115200);
delay(300);
}
void loop()
{
byte buff[8];
Wire.beginTransmission(Addr);
int error = Wire.endTransmission();
if( error != 0)
{
Serial.println( "CPS122 not acknowledging to its address");
}
// Give the sensor time to do the conversion.
delay( 300);
int n = Wire.requestFrom( Addr , 8);
if( n != 8)
{
Serial.println( "Could not request data from CPS122");
}
else
{
for( int i=0; i<8; i++)
{
buff[i] = (byte) Wire.read();
if( buff[i] < 0x10)
Serial.print( "0");
Serial.print( buff[i], HEX);
Serial.print( ", ");
}
Serial.println();
}}