|
I have created a circuit for a battery monitor using an ADS1115 analog-to-digital converter and voltage sensor. I can read the battery voltage using the sensor. I want to display the battery status on the mini OLED.
Initially, I try putting the code in the webServer.py, replacing "Adeept.com", and added the function which returns battery status (BatStat()). But this only gives battery status at the boot time because this piece of code only executes at the beginning. How can I properly place the code so that the OLED information continuously updates?
- try:
- import OLED
- screen = OLED.OLED_ctrl()
- screen.start()
- screen.screen_show(1, str(BatStat()))
- except:
- OLED_connection = 0
- print('OLED disconnected')
- pass
Copy the Code
|
|