Hi,
I am working on NRF52840, I want to read some ADC (Potentiometer) using I2C communication in NRF52840 MCU, Can you please help me, how to implement the code for this.
Thanks
Hi,
I am working on NRF52840, I want to read some ADC (Potentiometer) using I2C communication in NRF52840 MCU, Can you please help me, how to implement the code for this.
Thanks
Hi,
If I understand you correctly, you want to read an external ADC device that is interfaced over I2C? I2C devices have different command set to read values, so you will have to look in the datasheet of your specific device which commands you need to send to read the data. You can start out with the TWI sensor example, which showcases how to interface a TWI/I2C sensor device.
Best regards,
Jørgen
Hi,
As now, I want to interface with potentiometer using I2C, After reading the potentiometer data I have to send through BLE.
Hi,
Yes, that is possible. You can either send the data over the Nordic UART Service (NUS), see UART/Serial Port Emulation over BLE example, or you can create your own custom service, see the Service and Characteristics tutorials.
We do not have any examples showing how to send I2C sensor data over BLE, but you can have a look at this example sending data from the internal SAADC peripheral over NUS.
Best regards,
Jørgen
Hi,
Thanks for the reply.
Can you please tel me how to vary the potentiometer values over I2c in nrf52840.Please
Hi,
Thanks for the reply.
Can you please tel me how to vary the potentiometer values over I2c in nrf52840.Please
Can you please give me some sample code
We do not have any example code for that. You need to read the datasheet of the I2C device and implement the correct commands in your application to interface and configure the device.
ok sure,
Can you please give me sample code to read potentiometer.
How to read the potentiometer connected over I2C/TWI is described in the datasheet of the potentiometer. We do not provide code samples for every specific I2C sensors in existence, we provide general code samples that shows how to use the peripheral itself (for instance the TWI Sensor example I have already linked you). It is your job to write the driver for your specific device/sensor and integrate the correct commands with the peripheral example to interface the sensor.