2 Replies Latest reply on Dec 14, 2017 8:09 AM by sebastiaan.vanspauwen_2760591

    MPU 6050 - Need help reading sensor values

    sebastiaan.vanspauwen_2760591

      Hello,

       

      For a project I need to read out the sensor values of the MPU 6050.

      After doing some research I downloaded the project in this topic from 3 months ago MPU6050 w/PSOC4 - Implementing a Filter

       

      The only problem I am facing is that I am getting errors that there are too few arguments in the I2C functions provided by PSoC after I build the project.

       

      For example code for reading a byte of data:

      void I2CReadBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *value) {

           uint8_t i=0;

           I2C_MPU6050_I2CMasterSendStart(devAddr, I2C_MPU6050_I2C_WRITE_XFER_MODE);

           I2C_MPU6050_I2CMasterWriteByte(regAddr);

           I2C_MPU6050_I2CMasterSendRestart(devAddr, I2C_MPU6050_I2C_READ_XFER_MODE);

           while (i++ < (length-1)) {

                *value++ = I2C_MPU6050_I2CMasterReadByte(I2C_MPU6050_I2C_ACK_DATA);

           }

           *value = I2C_MPU6050_I2CMasterReadByte(I2C_MPU6050_I2C_NAK_DATA);

           I2C_MPU6050_I2CMasterSendStop();

      }

       

      These functions expect more parameters now than the project that I downloaded from 3 months ago, while the project is still PSoC 4.

      Is it possible to avoid these errors so I can use this project to read the data?

       

      Thanks for reading

      Sebastiaan