Hi , can anyone say , how to write the values to the specific register through I2C..??

Reeshma
Posts: 37
Joined: Tue Mar 28, 2017 12:40 pm

Hi , can anyone say , how to write the values to the specific register through I2C..??

Postby Reeshma » Wed Apr 12, 2017 1:51 pm

Am a beginner to this platform , i don't know how to write the value to the specific register.
I just want like this...in esp32


const int MPU_addr=0x68;
const int ACCEL_CFG=0x1c;

Wire.beginTransmission(MPU_addr); // write the data to ACCEL_CFG
Wire.write(ACCEL_CFG);
Wire.write(0x01);
Wire.endTransmission();

can anyone say what change will i need to do , while interfacing the mpu6050 with esp32.

Hans Dorn
Posts: 62
Joined: Tue Feb 21, 2017 2:21 am

Re: Hi , can anyone say , how to write the values to the specific register through I2C..??

Postby Hans Dorn » Wed Apr 12, 2017 9:48 pm

There's an arduino core available for the esp32, if you want to use the arduino libraries.

https://github.com/espressif/arduino-esp32

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Hi , can anyone say , how to write the values to the specific register through I2C..??

Postby kolban » Thu Apr 13, 2017 3:01 am

Here are a couple of samples where we managed to get the MPU6050 working with C and C++ in ESP-IDF:

https://github.com/nkolban/esp32-snippe ... lerometers

and

https://github.com/nkolban/esp32-snippe ... PU6050.cpp
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Reeshma
Posts: 37
Joined: Tue Mar 28, 2017 12:40 pm

Re: Hi , can anyone say , how to write the values to the specific register through I2C..??

Postby Reeshma » Thu Apr 13, 2017 4:55 am

Thank you sir , the code had you posted its all related to reading the values from the register,
but now i want to write the values to the register through I2c and also to read the values from the register. Can anyone say how to do..?

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

Re: Hi , can anyone say , how to write the values to the specific register through I2C..??

Postby preetam » Thu Apr 13, 2017 8:02 am

Hi,

There is an example in esp idf at https://github.com/espressif/esp-idf/tr ... herals/i2c.

I was working on max10305 and below is the flow of execution.

1. check whether the part id matches.. i2c write with i2c address of max10305 and read the part id address
2. setup the power level, adc range etc.. 6 i2c writes.
3. read the values required.

As per my understanding after working with bme280 and max10305. we need to setup the i2c slaves before we can read the temperature, pressure from bme280.

Thank you
Paul

Reeshma
Posts: 37
Joined: Tue Mar 28, 2017 12:40 pm

Re: Hi , can anyone say , how to write the values to the specific register through I2C..??

Postby Reeshma » Mon Apr 17, 2017 6:29 am

Ok sir , thank you , i will try


Who is online

Users browsing this forum: No registered users and 137 guests