This post was last edited by dcexpert on 2019-10-6 20:19
We have introduced some basic methods of MakeCode graphical programming before. Now we will introduce methods of OLED, sensors, etc.
This example requires an I2C interfaced 128x64 resolution OLED module and connects the SDA/SCL to the SAMR21.
Connection method:
SDA:PA22
SCL:PA23
First, click the gear icon in the upper right corner of the programming interface and select Extensions in the pop-up drop-down menu.
After entering, an extension selection interface will be displayed. There is an input box on the interface where you can enter the extension name or address to quickly search for the required extension.
In the extension input box, enter the following URL and press Enter or click the search icon:
https://github.com/makecode-extensions/OLED12864_I2C_V2
After the search is successful, the OLED extension will be displayed (this process requires an Internet connection)
Click the OLED extension to add the extension to MakeCode and display the OLED module in the graphical module.
Using this extension, you can easily drive OLED to display text, numbers, dots, lines, rectangles, etc. There are two ways to display text: print and show string. The difference between them is that show string displays text at a specified position, while print simulates the printing method of the console, displaying text after the last displayed position and automatically wrapping.
The following program displays an increasing number every second and automatically wraps the line.
This content is originally created by dcexpert , a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source