[TH] Draw an analog clock using MicroPython.

บทความก่อนหน้านี้ได้กล่าวถึงการปรับปรุงปรับปรุงความเร็วในการแสดงผลด้วยการใช้เทคนิคดับเบิลบัฟเฟอร์ (double buffer) จึงนำมาประยุกต์ใช้สำหรับการแสดงผลเป็นนาฬิกาแบบแอนาล็อกดังภาพที่ 1 ซึ่งวิธีการวาดนั้นใช้การคำนวณตรีโกณมิติเพื่อหาค่าพิกัด (x,y) ของปลายเข็มวินาที นาที และชั่วโมง โดยการทำงานของแต่ละวินาทีจะใช้ตัวตั้งเวลาหรือไทเมอร์ (Timer) เพื่อให้การทำงานนั้นใกล้เคียงกับเวลาจริงมากกว่าการวนรอบหรือการหน่วงเวลา

ภาพที่ 1 ตัวอย่างผลลัพธ์ของการวาดนาฬิกาแบบแอนาล็อก

[EN] Using ESP32’s ADC and DAC with Micropython.

This article describes the implementation of the ESP32 microcontroller’s ADC (Analog-to-Digital Converter) and DAC (Digital-to-Analog Convertor) with MicroPython’s Python subclasses ADC and DAC, which fall under the machine class to learn both subclasses along with an example program to use the class as shown in Figure 1 as a basis for further development.

(Figure. 1 ADC/DAC’s example of use)