Hi all,
I am using the i2c 16x2 with a refreh rate around 3 Hz (raspberry with python) and for that usecase the bus seems to be to slow since I get a annoying blinking at each refresh.
So the question: Is it possible (I am using the adafruit library) to only refresh certain characters so I don´t need to send the whole display content? Or even better: Not clearing the screen before I send the new content but send a "replace the old character with this new one"- command?
My code now goes now something like this:
LCD.clear()
LCD.message("Display\nthis")
Any Ideas?
I2C 16X2 refresh to slow
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: I2C 16X2 refresh to slow
I'm pretty sure the font-drawing process replaces the characters, so using fixed-length, space-padded strings should give you clean transitions from one message to the next.
- pischu7
- Posts: 11
- Joined: Mon Mar 10, 2014 5:34 pm
Re: I2C 16X2 refresh to slow
Thanks for your repy. Actually I have no idea what you are talking about. However: Yesterday I found on this website (http://usualpanic.com/ - a big thanks to Sheldon Hartling) the sulution suitable for my level of knowledge.
from Queue import Queue
LCD_QUEUE = Queue()
#----------worker thread---------
def update_lcd(q):
while True:
msg = q.get()
# if we're falling behind, skip some LCD updates
while not q.empty():
q.task_done()
msg = q.get()
LCD.setCursor(0,0)
LCD.message(msg)
q.task_done()
return
if __name__ == '__main__':
LCD.begin(20,4)
LCD.clear()
worker = Thread(target=update_lcd, args=(LCD_QUEUE,))
worker.setDaemon(True)
worker.start()
So actually I don´t know how it´s working but it does what I want..
from Queue import Queue
LCD_QUEUE = Queue()
#----------worker thread---------
def update_lcd(q):
while True:
msg = q.get()
# if we're falling behind, skip some LCD updates
while not q.empty():
q.task_done()
msg = q.get()
LCD.setCursor(0,0)
LCD.message(msg)
q.task_done()
return
if __name__ == '__main__':
LCD.begin(20,4)
LCD.clear()
worker = Thread(target=update_lcd, args=(LCD_QUEUE,))
worker.setDaemon(True)
worker.start()
So actually I don´t know how it´s working but it does what I want..
Please be positive and constructive with your questions and comments.