[EN] Singly Linked List

This article is about programming C/C++ with Arduino Nano, Arduino Uno, LGT8F328P or other boards with C-capable platforms. A pointer is used to point to a memory address and memory management methods, including memory reservation memory access and deactivating the use of memory to create a method for storing data in a Single Linked List along with an example program used to store a list of temperature and humidity values ​​from the DHT11 module as shown in Figure 1.

Figure 1 Microcontroller with LGT8F328P and DHT11 module
Read More

[EN] LittleFS Filesystem

The article discusses the use of the LittleFS library and introduces a library developed for use with the esp32 microcontroller, which includes a plugin for the Arduino IDE for uploading files to the microcontroller’s ROM. Make it convenient to load data to store and run. For this reason, if programmers find it difficult to transcode HTML/CSS/JavaScript to be a string manually and switching to uploading files to esp32 and reading the web files directly to use will be something that will require training to use LittleFS as a reliable library.


Read More

[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
Read More

[TH] Queue data structure with array and Singly Linked List.

บทความนี้เป็นการอธิบายเกี่ยวกับโครงสร้างข้อมูลแบบคิว (Queue) ซึ่งได้เคยเขียนถึงไปในบทความ Queue Data Structure ที่เป็นภาษาไพธอนและถูกนำไปใช้บ่อยกับตัวอย่างของ MicroPython แต่บทความนี้เป็นภาษา C ที่เขียนผ่าน Arduino IDE เพื่อใช้งานกับบอร์ดไมโครคอนโทรลเลอร์ LGT8F328P, SAM-D21, ESP8266, ESP32 และ ESP32-S2 ดังภาพที่ 1 โดยยกตัวอย่างการนำโครงสร้างแถวลำดับ และลิงค์ลิสต์เดี่ยวมาเป็นโครงสร้างข้อมูลแบบคิว และคงเป็นบทความสุดท้ายบน JarutEx แล้วครับ

ภาพที่ 1 บอร์ดไมโครคอนโทรลเลอร์ ESP32-S2, LGY8P326P และ SAM-D21
Read More

[TH] Stack data structure with Singly Linked List.

บทความนี้เป็นการอธิบายเกี่ยวกับโครงสร้างข้อมูลแบบสแต็ก (Stack) เพื่อเขียนโปรแกรมด้วยภาษา C บนแพล็ตฟอร์มต่าง ๆ โดยใช้โครงสร้างข้อมูลแบบลิงค์ลิสต์เดี่ยวเป็นที่เก็บข้อมูลของสแต็กพร้อมตัวอย่างการแถวลำดับเป็นที่เก็บข้อมูล และทดสอบการทำงานกับบอร์ดไมโครคอนโทรลเลอร์ LGT8F328P, SAM-D21, ESP8266, ESP32 และ ESP32-S2 ดังภาพที่ 1 และ 2 ส่วนกรณีที่ต้องการไปใช้กับแพล็ตฟอร์มอื่น ๆ ยังคงสามารถดัดแปลงโค้ดเพื่อนำไปใช้ได้เช่นเดียวกัน

ภาพที่ 1 บอร์ดไมโครคอนโทรลเลอร์ ESP32, LGY8P326P และ SAM-D21
Read More

[TH] Arduino: ควบคุมการเคลื่อนที่หุ่นยนต์รถผ่านบราวเซอร์ด้วย esp8266 Part 2

จากบทความก่อนหน้าที่ใช้ esp8266 เพียงตัวเดียวสำหรับการควบคุม Agent ซึ่งจำนวนขาที่ไมโครคอนโทรลเลอร์ esp8266 (ตามที่เขียนไว้ในบทความเกี่ยวกับ machine.Pin ของ MicroPython) มีให้นั้นมีจำกัด และหลายขาถูกใช้งานขณะเริ่มระบบทำให้เกิดความผิดพลาดที่ไม่ได้ตั้งใจ เช่น ล้อหมุนเมื่อระบบเริ่มทำงาน และหยุดเมื่อระบบทำการบูตเสร็จ เป็นต้น ดังนั้น ในบทความนี้จึงเพิ่มบอร์ดไมโครคอนโทรลเลอร์ LGT8F328P เข้ามา ดังภาพที่ 1 หรือผู้อ่านอาจจะเปลี่ยนเป็นไมโครคอนโทรลเลอร์ตระกูล Arduino อื่น ๆ แทนได้ เช่น Arduino Nano หรือ Arduino Uno เป็นต้น โดยให้ LGT8F328P นั้นเป็นส่วนของ Actuator ที่ทำหน้าที่เคลื่อนที่ไปในสิ่งแวดล้อม คือ สามารถสั่งให้เดินหน้า ถอยหลัง เลี้ยวซ้าย เลี้ยวขวา และหยุดได้ ทำให้ลดภาระการทำงานของ esp8266 ลง และให้ทำงานตอบสนองการสื่อสาร WiFi ได้มากขึ้น

ภาพที่ 1 บอร์ด LGT8F328P ที่นำมาประกอบเข้ากับระบบหุ่นยนต์รถเพื่อใช้ควบคุมการเคลื่อนที่
Read More

[TH] Arduino: ควบคุมการเคลื่อนที่หุ่นยนต์รถผ่านบราวเซอร์ด้วย esp8266

จากบทความการควบคุมหุ่นยนต์รถ 2 ล้อแบบ Servo ใน ESP8266+RoboServo และมอเตอร์ไฟฟ้ากระแสตรงใน VisionRobo Car: Drive Motor ทางเราได้นำหุ่นยนต์รถในตัวที่ 2 เปลี่ยนจาก Raspberry Pi เป็น ESP8266 เพื่อสั่งงานผ่าน WiFi โดยใช้แนวทางจาก บทความ ESP-01s+Relay มาเขียนใหม่ด้วยภาษา C/C++ ของ Arduino ด้วยคลาส WebServer จากที่ในบทความของ ESP8266 เป็น MicroPython ดังนั้น เมื่อทำตามบทความนี้จนเสร็จจะสามารถสั่งงานหุ่นบนต์ในภาพตัวอย่างที่ 1 ได้ด้วยการเชื่อมต่อโทรศัพท์หรืออุปกรณ์สื่อสารไปที่ 192.168.4.1 และสั่งให้เดินหน้า ถอยหลัง เลี้ยวซ้าย เลี้ยวขวา หรือหยุดได้

ภาพที่ 1 ตัวอย่างหุ่นยนต์รถสำหรับการทดลองในบทความนี้
Read More

[TH] Generate temperature and humidity graphs with data from Singly Linked List.

จากบทความโครงสร้างข้อมูล Singly Linked List, การใช้โมดูลเซ็นเซอร์ DHT11 กับไมโครคอนโทรลเลอร์ STM32F103 และการใช้โมดูลแสดงผล TFT ที่ใช้ตัวควบคุม st7735s จึงเกิดเป็นแนวคิดของบทความนี้ คือ นำตัวอย่างการใช้โครงสร้างข้อมูลแบบลิงค์ลิสต์เดี่ยวที่เก็บค่าอุณหภูมิและความชื้นมาหาค่ามากสุด น้อยสุด ค่าเฉลี่ย พร้อมทั้งข้อมูลในลิสต์มาแสดงในรูปแบบของกราฟดังภาพที่ 1

ภาพที่ 1 ตัวอย่างผลลัพธ์ที่ได้จากบทความนี้
Read More

[TH] Singly Linked List

บทความนี้เป็นการเขียนโปรแกรมภาษา C/C++ กับบอร์ด Arduino Nano, Arduino Uno, LGT8F328P หรือบอร์ดอื่น ๆ และแพล็ตฟอร์มอื่น ๆ ที่ใช้ภาษา C ได้ โดยในบทความนี้กล่าวถึงวิธีการใช้โครงสร้าง struct สำหรับเก็บข้อมูลและตัวชี้ที่ใช้สำหรับชี้ไปยังตำแหน่งของหน่วยความจำ และวิธีการบริหารหน่วยความจำได้แก่ การจองหน่วยความจำ การเข้าถึงหน่วยความจำ และการยกเลิกการใช้หน่วยความจำเพื่อสร้างวิธีการจัดเก้บข้อมูลแบบลิงค์ลิวต์เดียว (Singly Linked List) พร้อมทั้งตัวอย่างโปรแกรมที่ใช้สำหรับเก็บรายการค่าอุณหภูมิและความชื้นจากโมดูล DHT11 ดังภาพที่ 1

ภาพที่ 1 บอร์ดไมโครคอนโทรลเลอร์ที่ใช้ชิพ LGT8F328P กับโมดูล DHT11
Read More