Hello…I am using the ADC onboard the am335x for data findings. I do not know the name of the ADC. Is there a specific naming scheme for the ADC onboard the BBB? What is the name of the ADC on the am335x supported BBB?
My logic seems to be a bit off now. I have started a sort of findings page on Hackaday.io which can be found here: BeagleBone Black and the MaxBotix Sensor | Hackaday.io
Since my start with using the onboard ADC, I found some nice tutorial on the docs.beagleboard.org and am further investigating procedures for signaling down to as close as possible data for acquisition.
There is a many things to do and the BBB along with other boards have the ADC available. So, why? Well, I am still learning about computer logic and how to promote research into computer logic.
#!/usr/bin/python3
# //////////////////////////////////////
# // ultrasonicRange.py
# // Reads the analog value of the sensor.
# //////////////////////////////////////
from time import sleep
import math
foot = 0
inch = 0
mm = 0
ms = 550.0 # Time in milliseconds
pin = "0" # sensor, A0, P9_39
IIOPATH='/sys/bus/iio/devices/iio:device0/in_voltage'+pin+'_raw'
f = open(IIOPATH, "r")
ADC = (1.8 / 512) / (1 / 12)
ADC_mm = (1.8 / 512) / (1 / 12) * 25.4
try:
print("We are waiting five seconds and then starting")
sleep(5)
ADC_or_ADC_MM = str(input("Please type ADC or ADC_mm, Thank you!"))
while True:
if ADC: # ERROR
f.seek(1)
ADC = f.read()[:-1]
print('data = ' + ADC)
sleep(ms / 1500)
elif ADC_mm: # ERROR
f.seek(1)
ADC_mm = f.read()[:-1]
print('data = ' + ADC_mm)
sleep(ms / 1500)
except KeyboardInterrupt:
pass
print("The end...")
If you see where I have gone astray, please do reply. I am trying to figure out more and more as time passes. I have found many articles on specific ADC peripherals and each have their own take on how to promote source code dedicated to the 5v - 8-bit, 3.3v - 12-bit, and so on different types.
Seth
Update…
I just saw an error. Okay. Off to test…