[EN] Arduino: data types

This article discusses variables, data types and constants for use with Arduino, the basis of programming. This is because programming has principles, as Niklaus Wirth has said since 1976 in his book that

Algorithms + Data Structures = Programs

A program is a problem-solving algorithm that processes data, which is the main reason for the difference between computation and program.

Read More

[TH] ลองเล่น Cytron Maker Pi PICO ด้วย CircuitPython

บทความนี้เป็นการแนะนำบอร์ด Maker Pi PICO ของ Cytron (ภาพที่ 1) ที่ติดตั้งไมโครคอนโทรเลอร์ Raspberry Pi PICO พร้อมทั้งบอร์ดขยายการใช้งานที่มีอุปกรณ์พื้นฐานที่จำเป็นต่อการฝึกฝนเขียนโปรแกรมและใช้งานจริง เช่น หลอดแอลอีดี ช่องอ่านการ์ดหน่วยความจำ (micro SD-Card) หรือ ลำโพง เป็นต้น ซึ่งนอกเหนือจากการแนะนำบอร์ดแล้ว บทความนี้กล่าวถึงการติดตั้งและใช้งาน CircuitPython  ซึ่งเป็นไพธอนที่นำ  MicroPython มาปรับปรุงเพื่อใช้งานกับอุปกรณ์ของ Adafruite และของบริษัทอื่น ๆ ส่วนผู้ที่วนใจบทความที่ใช้กับ MicroPython ทางทีมงานขอแนะนำให้ศึกษาจากเว็บของอาจารย์ดร.เรวัต ศิริโภคาภิรมย์ ต่อไปนี้ซึ่งมีรายละเอียดที่ครบครันกว่าพวกเรามาก

  1. MicroPython for RP2040 Pico
  2. RPi Pico RP2040 Code Examples
  3. PIO Programming
  4. PIO Signaling and Measurement
  5. นอกจากนี้มีบทความส่วนของ CircuitPython ด้วยเช่นกันในบทความ CircuitPython for Pico RP2040
ภาพที่ 1 บอร์ด Maker Pi PICO
Read More

[TH] เกมวิ่งเก็บธงในเขาวงกต

บทความนี้เป็นตัวอย่างการเขียนเกมขยับตัวละครให้เดินไปในเขาวงกตเพื่อเก็บธงที่ถูกสุ่มตำแหน่ง ดังภาพที่ 1 ซึ่งตัวละครจะเดินในช่องที่กำหนดไม่สามารถทะลุกำแพงได้ โดยมีเสียงร้องเตือนเมื่อพยายามเดินไปในตำแหน่งที่ไม่สามารถไปได้ และเมื่อเดินไปทิศใดจะเปลี่ยนภาพของตัวละครให้หันไปทางทิศนั้น นอกจากนี้กำหนดให้การกดปุ่ม A ให้เป็นการสุ่มตำแหน่งของธงใหม่ การกดปุ่ม B ให้ทำการสุ่มตำแหน่งของผู้เล่น และถ้ากดปุ่ม D ให้ออกจากโปรแกรม โดยบอร์fสำหรับใช้งานยังคงเป็น dCoreML4M เช่นเดิม มาเริ่มกันครับ

ภาพที่ 1 ตัวอย่างเกมของบทความนี้
Read More

[EN] Arduino: Ohm’s Law

This article is about Ohm’s Law, which is a fundamental subject related to electrical circuits that arise from the relationship between the current in amps, the voltage (Volt) and the resistance of the conductor or load is measured in Ohm, or the equation V=IR, where V is voltage, I is current, and R is the resistance of the conductor.

Read More

[EN] Node.js&Phaser.js

This article discusses installing Phaser.js as a game framework and using Node.js as a web resource provider for the Raspberry pi 4, enabling the board to be the web server for games we’ve developed. The article discusses the creation of a project, installing libraries, master coding and running the service machine to allow the client to run the game through the browser.

Read More

[TH] The dCore-espWST

บทความนี้แนะนำการใช้ esp8266 เพื่ออ่านอุณหภูมิความชื้นจากเซ็นเซอร์ DHT11 ค่าแรงดันจากเซ็นเซอร์ LDR รับค่าจากสวิตช์ และแสดงผลผ่านทาง OLED ด้วยภาษาไพธอนของ MicroPython โดยคุณสมบัตินี้เป็นบอร์ด dCore-espWST ที่พวกเราใช้งาน (ซึ่งบทความก่อนหน้านี้เราก็ใช้ตัว dCore-esp32WST ที่มีการออกแบบเหมือนกันแต่ใช้ esp32 แต่โค้ดโปรแกรมยังคงใช้กับบอร์ดรุ่นได้ด้วยเช่นกัน) และเป็นบอร์ดสำหรับใช้ในการเรียนการสอนวิชา IoT โดยโครงสร้างต้นแบบของบอร์ดเป็นดังภาพที่ 1 ซึ่งปกติจะใช้กับชุดจ่ายไฟจากระบบแบตเตอรีพร้อมวงจรชาร์จจากแผงโซลาเซลล์

ภาพที่ 1 ต้นแบบของบอร์ด dCore-espWST
Read More