Code: Select all
pin1 = AnalogIn(board.D1)
pin1Threshold = 1.6
def getVoltage(pin):
voltage = (pin.value * 3.3) / 65536
return voltage
def gitPin(pin)
if pin == 1:
return pin1Threshold, getVoltage(pin1)
pinNumber = 1
threshold, voltage = getPin(pinNumber)
print('Threshold: ', threshold)
print('Voltage: ', voltage)
The voltage of the pins with nothing plugged in varies between 0.8 to 2.2volts with nothing plugged in. This is with just a Trinket M0 plugged into the desktop using the micro USB.
Why is this? I would think the voltage should be 0 if there is nothing plugged in?
I am running the latest (as of yesterday) production release versions of both CircuitPython and the boot loader (was happening on the original version too, upgraded to see if it was a bug).