Once again I answer my own post from a discord answer by JasonTC
import thumby
from machine import ADC
adc = ADC(26)
# Average when unplugged is around 3700
# Average when plugged is around 4000
charging_threshold = 38500
average_charging_value = adc.read_u16()
while True:
thumby.display.fill(0)
average_charging_value = (adc.read_u16() + average_charging_value) // 2
if average_charging_value > charging_threshold:
thumby.display.drawText("Charging", 0, 0, 1)
else:
thumby.display.drawText("Not charging", 0, 0, 1)
thumby.display.update()