[EN] Queue Data Structure

This article introduces the use of the list class in Micropython as a queue data structure with a limited number of members. It works according to the FIFO (First-In-First-Out) principle, which can be applied in a variety of applications, such as being used as a storage, and when the data is full but we need to insert new data, the old data must be pop out. The example in this article uses the dCore-miniML board (Figure 1) to read the temperature of the chip and store it in a Queue structure and display it in a bar graph and Micropython implemented firmware version 1.16 (2021-06-23) for the ESP Module (SPIRAM).

(Figure. 1 An example of drawing a graph with data stored in a queued data structure)
Read More

[TH] Queue Data Structure

บทความนี้แนะนำการใช้คลาส list ใน Micropython มาประยุกต์เป็นโครงสร้างข้อมูลคิวที่มีจำนวนสมาชิกจำกัด และทำงานตามหลักการ FIFO (First-In-First-Out) ซึ่งสามารถนำไปประยุกต์ใช้ได้หลากหลาย เช่น ใช้เป็นที่เก็บข้อมูลและเมื่อข้อมูลมีเต็มแล้วแต่ต้องการนำข้อมูลใหม่ใส่เข้าไป ดังนั้น จึงต้องนำข้อมูลเก่าอันดับที่ 1 ที่ใส่เข้ามาออกไป ซึ่งตรงกับหลักการของ FIFO เป็นต้น โดยตัวอย่างในบทความนี้ใช้บอร์ด dCore-miniML (ในภาพที่ 1) อ่านข้อมูลอุณหภูมิของชิพมาเก็บไว้ในโครงสร้างแบบคิวและแสดงผลออกมาในลักษณะของกราฟแท่ง และไมโครไพธอนที่นำมาใช้เป็นเฟิร์มแวร์รุ่น 1.16 (2021-06-23) สำหรับ ESP Module (SPIRAM)

ภาพที่ 1 ตัวอย่างการวาดกราฟด้วยข้อมูลที่เก็บในโครงสร้างข้อมูลแบบคิว
Read More