Closed MDH0 closed 5 months ago
As this is unrelated to RPPAL and more of a general ADS111x interface question, this isn't really the right place for this question. However, if anyone can help you out they're of course welcome to.
Unfortunately I don't have any personal experience working with an ADS1115. I suggest making sure you're using the correct I2C functions based on the datasheet (check this example on how RPPAL typically interacts with I2C registers), and perhaps look at how some other ADS111x driver implementations in Rust obtain their readings.
My team is actually working on a project using the ADS1015 at this moment, and we've been using eldruin/ads1x1x-rs which provides the implementation of the communication protocol for various ADS devices. I would recommend using an existing library rather than trying to reimplement the message formats yourself. The library constructs support embedded-hal
traits, so you can use it with RPPAL's I2C instance by including the hal
feature.
use ads1x1x::{Ads1x1x, SlaveAddr};
use rppal::i2c::I2c;
fn main() {
let dev = I2c::new().unwrap();
let mut adc = Ads1x1x::new_ads1115(dev, SlaveAddr::default());
adc.read(...)
}
Hello.
Sorry if the question isn't suited for this place.
Currently I am trying to communicate with an ADS1115 through an I2C connection. But right now I am not 100% sure, if what I did was right.
I was able to get the most useful data with the following code:
On the ADS the ports A0 and A1 are connected to a joystick. This resulted in the following output:
So right now, at the start of the program it is reading 0 and 98 as the input values and after moving the joystick around, the values change to something somewhat meaningful.
Can someone tell me, if I am moving in the right direction?
I am using an RPi 5.
Thanks for every help.