When using the microbit V2's LED screen and OLED screen in the same project, it was found that simultaneous execution between the two screens would occur.
Hi John, when I use the microbit V2's LED screen and the OLED screen in the same project I find that the two screens are executed at the same time, e.g. when I display a certain text on the OLED screen, the microbit V2's LED screen keeps blinking, is there a conflict between the VMs?
Have a nice life!
Comments (11)
-
repo owner -
repo owner - changed status to open
-
reporter Thank you so much, this is very helpful!
-
repo owner - changed status to resolved
-
reporter Hi John, I'm using a microbit LED screen and an OLED screen, the scenario I'm using is that I want the OLED to display only text and the microbit LED screen to display some motion graphics, but when using the microbit LED screen to display the graphics, the OLED will also display them along with it, and the text that was originally displayed will be lost, I've tried the method that you've recommended before but it doesn't seem to be working, here's a video of me testing it.
Here is my procedure
-
repo owner Thanks for the video. Now I understand the problem. Should be easy to fix.
-
repo owner - changed status to open
-
reporter That's great, I'll test it after you fix it.
-
repo owner It is now available in the latest pilot release. You will need to update the firmware on your micro:bit to v199.
-
reporter Thank you very much, it works great now!
-
repo owner - changed status to resolved
- Log in to comment
Hi, YX Feng.
I suspect what is happening is that OLED updates are hogging the CPU. Each screen update involves transferring 1024 bytes of data over the I2C bus, and during that time the CPU is not available to service the LED screen, which itself needs to be updated frequently to avoid flickering.
There are several possible remedies. One is to add a "wait 1 milliseconds" block after each graphic operation. Or it may work to add a single "wait" block to the loop that draws to the OLED.
A more elegant way to solve this problem is to defer the screen updates while doing multiple graphic operations. If you are using the TFT library (recommended) to work with the OLED display, you will first need to enable advanced blocks. Then, use the "_defer monochrome display updates" and "_resume monochrome display updates" blocks from the TFT library. Add the "defer" block before the set of graphics operations and the "resume" at end. If you are using the "OLED Graphics" library, you can use the "defer display updates" and "show display buffer" blocks to accomplish the same thing.
Hope that helps.