View: 290|Reply: 0

Battery monitor

[Copy link]

2

Threads

2

Posts

12

Credits

Newbie

Rank: 1

Credits
12
Post time 2023-8-21 23:57:37 | Show all posts |Read mode
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?
  1. try:
  2.     import OLED
  3.     screen = OLED.OLED_ctrl()
  4.     screen.start()
  5.     screen.screen_show(1, str(BatStat()))
  6. except:
  7.     OLED_connection = 0
  8.     print('OLED disconnected')
  9.     pass
Copy the Code


Reply

Use magic Report

You have to log in before you can reply Login | Sign Up

Points Rules