I've been working on trying to get a voltage reading from an input to the Trinket m0. Was feeding in about .5 V to one of the I/O ports, and was getting a voltage reading of about 40,000 out of the 65535 scale that the device outputs voltages in. Converted voltage reading is about 2V out of 3.3 V device can handle. However, even when disconnecting the voltage input and just reading the voltage of the pin while the device isn't connected to a signal- still getting around this same voltage reading. Is there an issue with noise of the devices? Would assume voltage should be around 0V . Any help on the Analog In function, alternate ways of getting voltage readings, noise troubleshooting, etc. would be helpful.
This is code I'm using:
import board
import analogio
import time
adc0 = analogio.AnalogIn(board.A2)
adc1 = analogio.AnalogIn(board.A0)
adc2 = analogio.AnalogIn(board.A1)
print(adc0.value)
print(adc1.value)
print(adc2.value)
I shorted pin 0 and pin 1~ to ground, no connection to pin 2-
returned voltage values are:
53664
31488
41360
This is code I'm using:
import board
import analogio
import time
adc0 = analogio.AnalogIn(board.A2)
adc1 = analogio.AnalogIn(board.A0)
adc2 = analogio.AnalogIn(board.A1)
print(adc0.value)
print(adc1.value)
print(adc2.value)
I shorted pin 0 and pin 1~ to ground, no connection to pin 2-
returned voltage values are:
53664
31488
41360