บทความนี้เป็นการใช้งานระบบไฟล์ของ MicroPython โดยใช้บอร์ดไมโครคอนโทรลเลอร์ esp8266 และ esp32 เป็นบอร์ดทดลอง ซึ่งการใช้งานระบบไฟล์เกี่ยวข้องกับไดเร็กทอรีและไฟล์ รวมถึงการเชื่อมต่ออุปกรณ์ให้ถูกมองเป็นระบบไฟล์ของ MicroPython เช่น การเชื่อมต่อกับ SD-Card เพื่อมองเป็นไดเร็กทอรีของระบบ เป็นต้น เป็นการใช้งานคลาส os ส่วนการสร้างไฟล์ เปิด เข้าถึงเพื่ออ่าน เข้าถึงเพื่อเขียนข้อมูล และการปิดการใช้งานไฟล์จะเป็นส่วนของคลาส file ของ MicroPython
Read MoreMonth: September 2021
[EN] VisionRobo Car: Drive Motor
This article is programming in Python to drive a robot moving with wheels. VisionRobo car is a robot kit that is equipped with a DC motor that is attached to a wheels gear set. It uses a circuit to drive a DC motor connected to Raspberry Pi Board and connect a USB WebCamera Module and Ultrasonic Sensor Module for image processing and calculate the distance of the robot to the surrounding objects.
Read More[TH] การเขียนโปรแกรมไคลเอนต์/เซิร์ฟเวอร์สำหรับสถานีอากาศผ่านระบบเครือข่ายไร้สาย
บทความนี้เป็นตัวอย่างการเขียนโปรแกรมไคลเอนต์/เซิร์ฟเวอร์สำหรับสถานีอากาศผ่านระบบเครือข่ายไร้สาย (Client/Server Programming for Weather Stations via Wireless Networking) โดยใช้ไมโครคอนโทรลเลอร์ esp32 จำนวน 2 ตัวสื่อสารกันผ่านเครือข่ายไร้สาย โดยกำหนดให้ตัวที่ติดตั้งเซ็นเซอร์ DHT22 และ LDR เป็นเครื่องให้บริการ (Server) ทำงานในโหมด AP และบอร์ดไมโครคอนโทรลเลอร์ esp32 อีกบอร์ดหนึ่งทำงานเป็นลูกข่าย และสื่อผ่านทางพอร์ตที่กำหนดขึ้นมาเอง เพื่ออ่านค่าอุณหภูมิ ความชื้นและค่าดิจิทัลที่ได้จากเซ็นเซอร์ LDR ดังภาพที่ 1
Read More[EN] Raspberry Pi & Ultrasonic Sensor
This article discusses how to use an ultrasonic module with a Raspberry Pi board (the previous article applies to the ESP8266) in Python to show the distance from the sensor to the closest object found.
Read More[TH] ESP8266/ESP32 WiFi
บอร์ด ESP8266 และ ESP32 เป็นอุปกรณ์ที่มีระบบการเชื่อมต่อสัญญาณ WiFi ในตัว โดยสามารถทำงานได้ทั้งโหมดการให้ตนเองเป็น AP (Access Point) และโหมดลูกข่ายที่เชื่อมต่อเข้ากับเครือข่าย WiFi ที่มีอยู่แล้วหรือ STA โดยผู้พัฒนาสามารถตั้งชื่อของอุปกรณ์ (ESSID) หรือใช้ชื่อตามค่าที่ตั้งจากระบบเป็น MicroPython-xxxx ซึ่ง x แทนค่า MAC Address ของอุปกรณ์ โดยรหัสผ่านเป็น micropythoN (ผู้พัฒนาสามารถกำหนดใหม่ได้) พร้อมรหัสหมายเลขไอพี (IP Address) เป็น 192.168.4.1
Read More[EN] QRCode Detected!
This article describes how to use OpenCV to find QRCode from an image from a Web Camera connected to the Raspberry Pi via a USB port. The example contains an example of reading the results from a web camera. And exit the program by pressing the ESC key, the QRCode search example and decoding the text within the image and storing the result in the image file.
Read More[EN] Speech to Text & Text to Speech
This article is an example of python implementation to call a speech-to-text service, then send a message to Google’s text-to-speech service to generate and return an mp3 audio file, and finally, use pygame to play the speech out of the speaker. It runs on the Windows operating system.
Read More[TH] เกม 15-Puzzle
บทความนี้เป็นตัวอย่างเกม 15-Puzzle โดยใช้บอร์ด ml4m ที่มีผลลัพธ์ของหน้าจอดังภาพที่ 1 ซึ่งเป็นเกมที่ทำให้ผู้เล่นได้ฝึกทักษะการคิดแบบมีกลยุทธ์มีการมองเกมล่วงหน้าเพื่อวางแผนการเลื่อนตัวเลข นอกจากนี้เกม 15-puzzle นอกจากอยู่ในรูปแบบของตัวเลขแล้วยังสามารถเปลี่ยนแปลงจากตัวเลขให้เป็นภาพ คือ เปลี่ยนเป็นภาพ 1 ภาพและแบ่งออกเป็น 16 ส่วน แล้วให้ผู้เล่นทำการเลื่อนภาพเพื่อต่อให้เหมือนกับต้นฉบับ นอกจากนี้ในตัวอย่างมีการใช้บัซเซอร์ในการสร้างเสียงบี๊บโดยใช้ DAC ขนาด 8 บิตของไมโครคอนโทรลเลอร์ esp32 พร้อมทั้งการเขียนโปรแกรมเลือกใช้ภาษาไพธอนบน MicroPython เช่นเคย
Read More[EN] Data Science Ep1 Pandas
This article is an implementation of Python’s Pandas library using the Raspberry Pi 3 B+ board. It can be applied to Python of Windows, macOS or Linux operating systems. The article will be divided into several episodes like the previous ulab library. The article EP 1 discusses Pandas features, installation and data structure of Pandas.
Read More