from machine import Pin, ADC
from time import sleep_ms, ticks_ms, ticks_add, ticks_diff
led = Pin(2, Pin.OUT)
pA = Pin(33)
a = ADC(pA)
jaChegamos = ticks_ms() + 3000
jaPiscamos = ticks_ms() + 500
while True:
if ticks_ms() >= jaPiscamos:
led.value(not led.value())
jaPiscamos = ticks_ms() + 500
if ticks_ms() >= jaChegamos:
valor = a.read()
msg = f'{valor:6.1f}'
print(msg)
arquivo = open('dados.csv','a')
arquivo.write(msg)
arquivo.close()
jaChegamos = ticks_ms() + 3000
#sleep_ms(3000)