I have no idea what 'nan' is.
I do not see any serial communication in your sketch.
But opening the serial monitor, causes a reset.
Perhaps your screen needs some extra time to reset after power on.
So try to have a larger delay() in line 18, and if that doesn't help, put in some extra delays in other lines, just to test.
If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.
I have no idea what 'nan' is.
I do not see any serial communication in your sketch.
But opening the serial monitor, causes a reset.
Perhaps your screen needs some extra time to reset after power on.
So try to have a larger delay() in line 18, and if that doesn't help, put in some extra delays in other lines, just to test.
thanks for reply, I tried your suggestion, but it didnt help. if i do not have serial monitor open loop function doesnt work. if I have serial monitor open the OLED updates, if i close serial monitor window the text on doest updates from the loop function.
why is loop function dependent on serial monitor window being open ?
I have no idea what ‘nan’ is.
I do not see any serial communication in your sketch.
But opening the serial monitor, causes a reset.
Perhaps your screen needs some extra time to reset after power on.
So try to have a larger delay() in line 18, and if that doesn’t help, put in some extra delays in other lines, just to test.
NAN is normally “No A Number” it is normally used to denote division by Zero.
It is difficult to provide any help to the other person since they did not indicate which Arduino board they are using.
I would suggest that they post the question on the adafruit forums. they may have some better insight into the workings or not workings of the adafruit devices.