I'm displaying the millisecond count from Arduino's millis() function, on an I2C OLED display. But I'm getting corrupted font characters. How can this be fixed?
Good morning all…
Youtuber, shed dweller, solar charge controller aficionado
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Gracias por la info Julian
Thanks, Julian, it was very helpful for me!
nice work THANK YOU!
I searched many hours for the solution. Thank you that he shared with me.
request : show how to get font alignment.
temp : 72,21
RH : 34.75
pr : 29.92
change font and get
p : 72,21
: 34.75
: 29.92
i write all as you are and i get
'u8g' was not declared in this scope next to the u8g.firstPage();
was im doing something wrong ?
you should show a STM32 chip , icstation sells them, i no longer have a reason to buy an arduino
So, the takeaway is that you shouldn't update values in the loop that updates the display. Seems obvious in retrospect. 🙂
Julian, Please get back in the garden and continue the Muppet project. I'm converting some of my lighting in the house to 12V LED charged from a dedicated 240W panel(s) and I need a good charge controller. Im up the road from you in Solihull so willing to be a test site.
good problem solving thinking.
Hi Julian, your problem is in your example code. In the do…while loop you write all pages while always using the current millis() time. So if millis increases while drawing a line, you get 5 lines with "1234" as millis, the next 5 lines with "1235" and so on.
So if you add "unsigned long millis_value = millis();" before the do…while loop and use millis_value instead of millis() itself, you will get rid of the tearing.
You could do something like:
void setup() {
last = millis();
}
voidloop(){
now = millis();
diff = now – last;
if (diff > 1000) {
updateYourDisplay(now);
last = now; // omitted in original post
}
}
Many thanks for the reply, working late I see. I would be very very interested in your illuminating is even more. Reply appreciated
Lol, my iphone glitched out and played the previous video i viewed instead… It literally looked like you were re-uploading videos for a second.
Your update rate for the display is too fast. You can't display a ms value in real time without some blurring of the numbers.
change int m to uint32 m to solve the integer overflow issue.
I note that you are using the latest 1.6.8 version of the Arduino IDE. When I installed this last week it rejected my u8glib library as incompatible with the IDE on every start up. I've just checked and the u8glib library doesn't seem to have been updated for some time, so I'm wondering if anyone else has had this problem.