Ceci est une ancienne révision du document !
WIO Terminal part 2 It’s hard to believe that this is the 24th MicroThisMicroThat! Time does fly when you are having fun (or just when you are old). Back in FCM#196, I wrote my first article on the Seeed Studio. Since MicroPython has upped their versions for all the various boards they support, I thought I’d try to update my little Wio terminal and re-test the program that I had written to see if it still worked. Just so you know, this was after the above-mentioned article, and I just never had a good chance to talk about it. Now, just a little background on writing to the Wio screen. It isn’t as easy as the normal screen output for, let’s say, a ssd1306. Remember, drivers try to be fairly generic in nature, while still being able to take as much advantage of the abilities of the display as possible. The driver for the ili9341 is no exception. As you saw in my article in FCM #196, this driver not only handles lines, circles, single pixels, and blocks, it also handles text. It even handles many font definitions for different text output to the screen.
Start by updating your Micropython firmware to version v1.21.0. You can download it at https://micropython.org/download/SEEED_WIO_TERMINAL/ Next, make sure you have the latest version of the LCD driver. This you can get from https://github.com/rdagger/micropython-ili9341/blob/master/ili9341.py For this article, we’ll focus on demonstrating the 8×8 default Micropython font. We’ll look at using different fonts in a later article. We’ll name this program “demo_text8x8.py”. Of course, we need to do the imports (top right)… Now we must define the backlight pin (below) and the spi object. After that, we can initialize the display object. Notice, if you are going to use the demo programs from the ili9341 driver website, you will need to change the spi assignments as I’ve done here. Also notice that we start the display with a default rotation of 90. This puts the display in (what I consider) the correct orientation, which is with the USB Cable at the bottom of the Wio terminal. We will send other rotation orientations near the end of the demo.
Next, we need to do some startup assignments (next page, bottom left). Be sure to make a call to backlight.on(). Otherwise you won’t see anything on the display (and do a backlight.off() when everything is finished) . Now we can start sending text to the display through the draw_text8x8() method of the display driver (right). Finally, we set the time that the display will be on, call the cleanup() method of the display, and turn off the backlight. The last thing we do is call the test function. sleep(15) display.cleanup() backlight.off() test() That’s it. I’ve set up another repository at my github repository site https://github.com/gregwa1953/MTMT-FCM-199 . Until next time, as always; stay safe, healthy, positive and creative!