Some proposals:
- separate the Neopixel animations into a function "def animation():" to have a better structured program.
- add a method "def log(message):" which writes messages to a file *
- after the ADC read method, add log( f"{read}")
- where you call the animation method, embrace the call with a try: ... animation() ... except Exception as e: ... log(str(e))
- embrace the main while loop with also a try ... see above
- measure the battery voltage using another ADC channel ** Perhaps the battery is depleted after some hours and a cold night.
*** give details about the battery used and how battery connected to pico. The pico powerchain allows to have usb connected without disassembly: if there is some space to plug in a USB cable and connect to a nearby laptop.
If you have a reset-button connected to the RUN pin, then use an external pullup of 10k.
- separate the Neopixel animations into a function "def animation():" to have a better structured program.
- add a method "def log(message):" which writes messages to a file *
- after the ADC read method, add log( f"{read}")
- where you call the animation method, embrace the call with a try: ... animation() ... except Exception as e: ... log(str(e))
- embrace the main while loop with also a try ... see above
- measure the battery voltage using another ADC channel ** Perhaps the battery is depleted after some hours and a cold night.
*
Code:
def log(message): with open("log.dat", "at") as f: f.write( f"{time.time():.3f}: {message} \n")
If you have a reset-button connected to the RUN pin, then use an external pullup of 10k.
Statistics: Posted by ghp — Thu Aug 22, 2024 5:28 pm