Blink cursor oled ssd1306

Hi, is there a way to blinking a cursor on oled 128x64?

I want to blink a text for just 1 line (or word)

You need to write the letter to the display in the chosen text colour then some time later (half a second maybe) write it again in the background colour, then again after the delay in the text colour. Continue like that.

Sorry i cant get what you said :sob: write again and again?

Yes, write it again and again, first in the text colour, then the background colour.

If i need it to blink for let say 2 minute, i'll have to rewrite it again and again like hundreds line of the same word?

Not hundreds of lines of code, no, you need a loop of some description.

From your questions I suspect you are not familiar with how to write a state machine or non-blocking code, am I correct?

Yes you are correct, and yes i try to make a loop of a single word on my oled. That is i trying to make now

1 Like

Sadly i cant find any example online

You will find these useful:
Using millis for timing

Demonstration for several things at the same time

Finite state machine tutorial Timer counter state change toggle FSM - all at once - Introductory Tutorials - Arduino Forum

If you understand those techniques a lot of this kind of thing will become easy.

Post the simplest complete code you have to write 1 line of text to your display, don't forget the code tags </>

I have an oled display on a board with a rtc, and use a simple blink without delay approach to flash the : between the hours and minutes. Instead of turning a led off or on as in blink without delay, I toggle a boolean variable which if my memory serves was imaginatively called "showColon" or some such. Then if showColon is true, display ":" and if it's not, display " ".

1 Like

Can you attach a simple example to use boolean like that?

For example, a line

display.setCursor(0, 1);
display.print(F("line one"));
display.setCursor(0, 10);
display.print(F("line two"));

To blink the word "line one" only

Well here's some pseudocode....

if it's time to blink the led (ala blink without delay, normal bwod stuff)
showColon=!showColon // ! means not

if showColon is true, display ":" else display " "

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.