This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define RXD1 (25) // กำหนดขา RX ของ Serial1 เป็นขา 25 | |
| #define TXD1 (26) // กำหนดขา TX ของ Serial1 เป็นขา 26 | |
| void setup() { | |
| Serial.begin(115200); // เริ่มต้นใช้งาน Serial0 ที่ความเร็ว (baud rate) 115200 | |
| Serial1.begin(9600, SERIAL_8N1, RXD1, TXD1); // เริ่มต้นใช้งาน Serial1 ที่ความเร็ว (baud rate) 9600 พร้อมกำหนดขา RX, TX ใหม่ | |
| } | |
| void loop() { | |
| while (Serial.available()) { // วนลูปหากมีข้อมูลเข้ามาจาก Serial0 (จาก Serial Monitor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <TFT_eSPI.h> | |
| #include <FT6336U.h> | |
| TFT_eSPI tft = TFT_eSPI(); | |
| FT6336U tp; | |
| void setup() { | |
| Serial.begin(115200); | |
| pinMode(14, OUTPUT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <FT6336U.h> | |
| FT6336U touch; | |
| void setup() { | |
| Serial.begin(115200); | |
| touch.begin(); | |
| } | |
| void loop() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <lvgl.h> // เรียกใช้ LVGL | |
| #include <ATD1.47-S3.h> // เรียกใช้ ATD1.47-S3 Lib | |
| void setup() { | |
| Serial.begin(115200); // ใช้งาน Serial Monitor ที่ความเร็ว 115200 | |
| Display.begin(); // สั่งให้จอเริ่มทำงาน | |
| Display.useLVGL(); // สั่งให้ LVGL เชื่อมต่อกับจอ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <ATD1.47-S3.h> // นำเข้าไลบารี่ ATD1.47-S3 Lib | |
| void setup() { | |
| Display.begin(); // สั่งให้หน้าจอเริ่มทำงาน | |
| Display.fillScreen(Display.color24to16(0x000000)); // เทสีหน้าจอสีดำ | |
| Display.drawLine(100, 10, 130, 100, Display.color24to16(0xFF0000)); // วาดเส้นที่พิกัดเริ่มต้น (100, 10) จบที่พิกัด (130, 100) สีแดง | |
| Display.drawRect(140, 10, 160, 80, Display.color24to16(0x00FF00)); // วาดกรอบสี่เหลี่ยมที่พิกัดเริ่มต้น (140, 10) จบที่พิกัด (160, 80) สีเขียว | |
| Display.fillRect(20, 10, 50, 50, Display.color24to16(0x0000FF)); // วาดสี่เหลี่ยมที่พิกัดเริ่มต้น (20, 10) จบที่พิกัด (50, 50) สีน้ำเงิน |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <ATD1.47-S3.h> // เรียกใช้ ATD1.47-S3 Lib | |
| void setup() { | |
| Serial.begin(115200); // ใช้งาน Serial Monitor ที่ความเร็ว 115200 | |
| Display.begin(); // สั่งให้จอเริ่มทำงาน | |
| Switch.begin(); // สั่งให้สวิตช์เริ่มทำงาน | |
| Display.fillScreen(Display.color24to16(0x000000)); // เทสีดำลงในจอ | |
| Switch.onPressed(A, []() { // เมื่อกดสวิตช์ A ให้ ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <lvgl.h> // เรียกใช้ LVGL | |
| #include <ATD1.47-S3.h> // เรียกใช้ ATD1.47-S3 Lib | |
| lv_obj_t *label; | |
| int count = 0; // สร้างตัวแปร count ใช้นับจำนวนครั้งที่กดปุ่ม ให้ค่าเริ่มต้นเป็น 0 | |
| void setup() { | |
| Serial.begin(115200); // ใช้งาน Serial Monitor ที่ความเร็ว 115200 | |
| Display.begin(); // สั่งให้จอเริ่มทำงาน |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <ModbusMaster.h> | |
| ModbusMaster sensor; | |
| void setup() { | |
| Serial.begin(115200); | |
| // Modbus communication runs at 9600 baud | |
| Serial2.begin(9600, SERIAL_8N1, 27, 26); // IOXESP32 Modbus RTU shield (Lite) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <IOXESP32Audio.h> | |
| #include <IOXESP32_4Digit.h> | |
| #define NEXT_SW_PIN (0) | |
| unsigned int count = 0; | |
| void setup() { | |
| Serial.begin(115200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <IOXESP32Audio.h> | |
| #include <IOXESP32_4Digit.h> | |
| #define NEXT_SW_PIN (0) | |
| unsigned int count = 0; | |
| void setup() { | |
| Serial.begin(115200); |