I2C difference in reading values with WiringPi and Pi4J

43 views
Skip to first unread message

Harald SATTMANN

unread,
Mar 29, 2016, 9:42:56 AM3/29/16
to Pi4J
Hi
I wrote a sample program and came over a severe problem. Using WiringPi the readouts of my TMP007 sensor is correct. Temperature rises -> read valeu rises but if I use Pi4J I get a value reading which is not continuously rising or falling instead of that I read values regions of rising pemeratur reading where this is not possible (and does not with Wiring Pi) Any idea.
What is the difference in the implementation of Wiring Pi (

    public TMP007_Protocol()
    {
        i2c_TMP007 = I2C.wiringPiI2CSetup(TMP007);
    }

    data = I2C.wiringPiI2CReadReg16(getI2C_TMP007(),0x1F);

or

try {
            bus01 = I2CFactory.getInstance(I2CBus.BUS_1); 
        }
        catch(IOException ex)
        {
            System.err.println("Producing I2C bus failed !!");
        }

                     try {
                        device.read(0x1E, buffer, 0, 2);
                        result = String.format("0x%04X", (int)(256*buffer[0]+buffer[1]));
                    }
                    catch( IOException ex)
                    {
                        result = "ERROR";
                    }

Reply all
Reply to author
Forward
0 new messages