Problem Serial port connexion and save file voltage variable
-
from machine import ADC import time import os import io adc = ADC() bat_voltage = adc.channel(attn=ADC.ATTN_11DB, pin='P16') vbat = bat_voltage.voltage() with open("vbatmv.txt", "a+") as f: while True : bat_voltage = adc.channel(attn=ADC.ATTN_11DB, pin='P16') vbat = bat_voltage.voltage() # note that the expansionboard 3 has a voltage divider of 1M / 1M to account for # 1M / 1M, ratio = 1:2 vbat = vbat*2 time.sleep(30) print('battery voltage:', vbat, 'mV') print(vbat, file=f)Hi, I can you help me to solve this problem , I try to save voltage value in file with print command some time work other not , and i have problem to connect tool upycraft to my pycom board 3.1 serial port in execution of this programme .
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login