On Sun, 10 Nov 2019 14:55:38 -0800 (PST), in
gmane.comp.hardware.beagleboard.user Mala Dies
<[email protected]> wrote:
>
>
>The line below voltage is the original numerical value w/ what I think is
>the a voltage to the right of voltage. Here is the updated source to the
>library:
>
>from LDRII import MCP3008
>import time
>
>adc = MCP3008()
>
>while True:
> Vref = 3.3
> Voltage = (Vref / 1023)
> print("voltage: \t", Voltage)
> print(adc.read(channel = 0))
> time.sleep(4)
>
>
That code is doing NOTHING with the ADC readings.
What you have calculated as "Voltage" is just the STEP value for the
ADC and it will never change. You have to multiply the step value by the
ADC reading to get the measured voltage. NOTE: you are defining Vref as 3.3
on EVERY pass of the loop: IT, and the STEP should be constants defined
outside the loop.
NOTE: those numbers you were reporting look a lot like noise on a
grounded signal pin. A reading of 16 is just 0.0516 volts.
You might want to look at
https://github.com/adafruit/Adafruit_CircuitPython_MCP3xxx/
(Adafruit is phasing out system specific libraries for CircuitPython -- and
provides the blinka library to map regular Python [as found on R-Pi and
BBB] to the CircuitPython API)
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux?view=all
(also applies to BBB if you follow the required install instructions for
blinka)
--
Dennis L Bieber
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/27chsedsolqve20s8sbjtashufr61r39nj%404ax.com.