Do you have ADC testing code in either C++ or Python for the Navio2?
I’m trying to connect a sonar Rangefinder to my Navio2, but hitting a brickwall.
The examples in C++ and Python don’t work:
C++: Failed to read device(-1): Input/output error Failed to write reg: Input/output error Failed to write reg: Input/output error Failed to write reg: Input/output error
Python: Error accessing 0x48: Check your I2C address Error accessing 0x48: Check your I2C address Traceback (most recent call last): File "ads1x15_ex_singleended.py", line 40, in <module> volts = adc.readADCSingleEnded(0, gain, sps) / 1000 File "/home/pi/navio/Python/ADC/Adafruit_ADS1x15.py", line 223, in readADCSingleEnded val = (result[0] << 8) | (result[1]) TypeError: 'int' object has no attribute '__getitem__'
@mikhail.avkhimenia - thanks for the response, I’ve got the ADC example working for me now (see below) but I can’t get the data into APM - I’ve tried pin 4 and pin 5 in APM, but no avail.
…hacked C++ ADC example…
I’ve hacked the C++ example to output voltage from all of the channels provided in /sys/kernel/rcio/adc/ reading from each of the 5 files in that dir and outputting thus: (ch0 | ch1 | ch2 | ch3 | ch4 | ch5)