This article describes how to use a set of condition check statements to create programming alternatives. C++ programming uses the { and } symbols for each block of action that means the instruction set in each block is always executed from top to bottom, with one action at a time, and can be executed by creating a condition. In addition, the desired part of the command can also be repeated by loop, which will be discussed in the next article.
Read MoreTag: C++
[EN] Arduino: Expression
An expression is a combination of operands and operators. An expression can be nested. However, programming principles differ from mathematics. For this reason, the conversion of an expression from a mathematical equation to an expression in a programming language requires a procedure to translate the correct sequence of calculations to prevent errors in calculations such as
Read More[EN] Arduino: Operators
This article compiles information about operators used in C++ to write expressions of commands. Operator marks are divided into five groups: Arithmetic, Boolean, Comparison, bitwise, and Compound.
Read More[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] Arduino : ESP8266 GPIO
ในบทความนี้เป็นการเรียนรู้เรื่องของ GPIO (General Purpose I/O) หรือขาเชื่อมต่อกับอุปกรณ์ภายนอกของไมโครคอนโทรลเลอร์ด้วยภาษา C++ ของ Arduino โดยใช้ esp8266 เป็นชิพอ้างอิง ซึ่งสามารถนำไปประยุกต์ใช้กับ Arduino Uno, Arduino Mega หรือ STM32 ได้เช่นกัน ภายใต้บทความนี้อธิบายเรื่องของการกำหนดหน้าที่ของขา การนำสัญญาณออก และการนำสัญญาณเข้า
Read More[TH] I2C Bus/Wire.h
บทความนี้เป็นการอธิบายเมธอดต่าง ๆ ของ Wire.h ซึ่งเป็นคลาสสำหรับสื่อสารกับอุปกรณ์ผ่านบัสประเภท I2C ที่ใช้สายสัญญาณ 2 เส้นเรียกว่า SDA และ SCL สำหรับรับส่งข้อมูลระหว่างกัน ศึ่งพวกเรามีบทความเกี่ยวกับการสื่อสารประเภทนี้ค่อนข้างเยอะ และใช้เป็นบัสหลักในการพัฒนาอุปกรณ์ขึ้นมาเองแล้วเรียกใช้งานผ่านบัส เข่น บทความการใช้ esp8266 เชื่อมต่อกัย Arduino Uno หรือ การใช้ esp8266 กับ stm32f030f4p6 เป็นต้น
Read More[TH] Arduino : DHT Sensor
บทความนี้เป็นการอธิบายการใช้งานไลบรารี DHT Sensor ของ Adafruit ที่รองรับกับทุกสถาปัตยกรรมที่ใช้กับ Arduino ได้ ทำให้สามารถประยุกต์การใช้งานเซ็นเซอร์ DHT ซึ่งใช้สำหรับอ่านค่าความชื้นและอุณหภูมิได้สะดวกและกับหลายแพลตฟอร์มได้ง่ายขึ้น โดยบทความนี้ได้ทดสอบกับ ESP32, ESP8266, Arduino UNO และ stm32f103c แล้วพบว่าสามารถใช้งานได้โดยไม่ต้องปรับแก้ไขโค้ดในส่วนของการทำงานหรือต้องเข้าไปแก้ไขรหัสต้นฉบับเพื่อให้ใช้งานได้กับแพลตฟอร์มที่ใช้งาน
Read More[TH] Arduino : RTC DS1302
จากบทความการเขียนโปรแกรมภาษาไพธอนบน Micropython เพื่อใช้งาน RTC เบอร์ DS1302 ในคราวนี้เปลี่ยนภาษาการเขียนโปรแกรมเป็น C++ สำหรับ Arduino โดยใช้ไมโครคอนโทรลเลอร์ Cortex-M0 เบอร์ STM32F030F4P6 / esp8266 และ Arduino Mega เป็นตัวทำงานแทน ESP32 ดังภาพที่ 1, 2 และ 6 โดยรายงานการทำงานออกทางพอร์ต RS232 เพื่อแสดงวันและเวลาตามตัวอย่างผลลัพธ์ในภาพที่ 4
Read More[TH] Arduino: JoyStick Shield
บทความนี้แนะนำการใช้ Game Pad/Joystick กับบอร์ด Arduino Uno หรือ Arduino Mega เนื่องจากเป็นโมดูลที่ออกแบบเป็น Shield ของบอร์ดทั้ง 2 เมื่อนำมาประกอบจะได้เกมแพดน่ารัก ๆ 1 ชิ้นดังภาพที่ 1 โดยในบทความอธิบายเพิ่มเติมเกี่ยวกับข้อมูลของการเชื่อมต่อระหว่างอุปกรณ์แต่ละชิ้นกับ GPIO พร้อมตัวอย่างการใช้งาน ซึ่งเนื้อหาเกี่ยวกับโมดูลจอยสติกอ่านได้จากบทความก่อนหน้านี้
Read More[TH] Arduino: Joystick Module
บทความนี้เป็นการเขียนโปรแกรมเพื่อใช้งานโมดูลจอยสติก (Joystick) ดังภาพที่ 1 ซึ่งตัวโมดูลสามารถบอกข้อมูลการเคลื่อนที่ในแกน X การเคลื่อนที่ในแกน Y และสถานะการกดสวิทตช์ที่ตัวจอยสติก โดยตัวอย่างการใช้งานโมดูลนี้เป็นการใช้กับบอร์ด esp32 โดยใช้ภาษา C++ เพื่อเชื่อมต่อกับ GPIO ด้วยคำสั่งที่เคยกล่าวไปแล้วในบทความนี้
Read More