[EN] Binary Search Tree data structure programming with Python.

In the previous article, programming to implement queue-based data structures was introduced. In this article, we introduce programming to manage another type of data structure which has different storage and management methods called BST tree or Binary Search Tree, as shown in Figure 1, which is a structure that can be applied to data collection with attributes in which the data in the left branch is less than itself and the right branch is greater than itself or the opposite, i.e. the left branch has a greater value and the right branch is less. It enables searching for data in cases where the tree is balanced on the left and right in the BST structure, saving half the time or number of search times per round of available data, e.g. 100 data sets in the first round if it is not the information you are looking for will be left with a choice to find from the left or right branches which the selection causes the information of the other side is not considered or cut off approximately half. However, if the Binary Search Tree is out of balance, the search speed is not much different from the sequential search.

In this article, we use Python that works on either a Python 3 or MicroPython interpreter to store the data, adding information ,searching for information as an example of further development.

BST : Binary Search Tree
Figure 1 BST

[EN] How to build MicroPython for esp32-C3.

This article discusses the previously recommended compiling (build) and use of MicroPython for esp32-C3 microcontrollers. The procedure is the same as for compiling for esp32-s2. In addition, we have solved the issue of RS232-to-USB from the board using CH340 to external pin using CP2102 instead and connecting the display module with OLED as Figure 1.

Figure 1 ESP32-C3 with OLED and external pins

[EN] How to build MicroPython for esp32-s2.

This article discusses compiling and using MicroPython for an esp32-s2 microcontroller based on the TTGO ESP32-S2 V1.1 or TTGO ESP32-S2-WOOR V1.1 board with a Type-C USB port and supports operation via CH340C and OTG by using a dip switch as shown in Figure 1, enabling MicroPython to be used because the chip program uses the CH340’s circuit programming and Python programming requires a port that works like OTG

TTGO ESP32-S2 V1.1
Figure 1 TTGO ESP32-S2 V1.1

[EN] Control movement from a joystick via WiFi with MicroPython.

This article is based on the article programming a client/server for a weather station over a wireless network or WiFi to modify from reading data from sensors to joystick shield (Arduino Joystick Shield) so that it has become a wireless game controller using MicroPython and an ESP32 microcontroller as shown in Figure 1. It is possible to control the movement of objects in the display via a ST7735 TFT screen connected to another ESP32. It will be found that the Python implementation of MicroPython is applicable in this example. And with an easy-to-write language and code that can be modified without recompiling and uploading, it’s easy to write prototype code for further development at a higher speed.

Control movement from a joystick via WiFi
(Figure. 1 Our board)

[EN] The MaixPy’s image class Part 1. draw and find something.

This article discusses how to use image class with TFT-LCD display module of Sipeed M1W dock suit board via lcd class (MaixPy’s lcd class) as shown in Figure 1 provided with MaixPy to study the list of commands provided by image class and an example program using commands about creating a buffer object, clearing the value in the buffer, deleting the buffer, drawing straight lines, circles, squares, character display, saving data from the buffer to memory card (microSD Card), searching for straight lines in buffer (find_lines), finding circles in the buffer, find_circles and find squares (find_rects) in buffers with built-in functionality. It uses the Hough Transform principle to find the position and parameters of the searched object.

(Figure. 1 Sipeed M1W dock suit)

[EN] Improve st7735 blue-tab/red-tab 0.96 ” library

This article is an update of the st7735 library file for Micropython by Billy Cheung (accessed 2021-09-07) published on github. It is a library that has been updated by Guy Caver to support ST7735s. The required libraries include st7735.py and sysfont.py Guy Carver implements esp8266 and esp32 to provide better display speed through the principle of display buffering for pixel storage and additional instructions for sending data from buffer to TFT module via SPI bus.

(Figure. 1 dCore-miniML board with ST7735 0.96″ display module installed)

[EN] Collecting flags in a maze

This article is an example of writing a game. Move the character to walk in the maze to collect flags that are randomly positioned as shown in Figure 1, where the character will walk in the specified channel and can’t penetrate the wall. With a warning sound when trying to walk in an impossible location and when walking in any direction will change the image of the character to turn the face to that direction. In addition, pressing A will randomize the position of the new flag, pressing B will randomize the player’s position, and pressing D will exit the program. The board for use is still dCoreML4M as before, let’s get started.

(Figure. 1 The game in this article)

[EN] The dCore-espWST

This article recommends using the esp8266 to read temperature and humidity from the DHT11 sensor, the voltage from the LDR sensor, received from the switch, and display via OLED with MicroPython’s Python language, this feature is the dCore-espWST board we are using (Which in the previous article we used the dCore-esp32WST with the same design, but using esp32, but the program code can still be used with the model board) and is a board for use in teaching IoT subjects. The prototype structure of the board is as shown in Figure 1, which is normally used with a battery power supply unit with a solar panel charging circuit.

(Figure. 1 dCore-espWSTprototype)