#define LED_PIN (LED_BUILTIN) // กำหนด LED_PIN ให้เป็นขาเริ่มต้นของ LED บนบอร์ด (เช่น LED_BUILTIN)
// Define LED_PIN as the default LED pin on the board (e.g., LED_BUILTIN).
#define DELAY_MS (500) // กำหนด DELAY_MS ให้เป็นค่าความล่าช้า 500 มิลลิวินาที
// Define DELAY_MS as the delay value of 500 milliseconds.
void setup()
{
// ตั้งค่า LED_PIN เป็น output เพื่อให้สามารถควบคุมสถานะของ LED ได้
// Set the LED pin direction to output to control the LED state.
pinMode( LED_PIN, OUTPUT );
// ตั้งค่า LED_PIN เป็น LOW (ปิด LED) เริ่มต้น
// Output LOW to the LED pin (turn the LED off initially).
digitalWrite( LED_PIN, LOW );
}
void loop()
{
// เรียกใช้ฟังก์ชัน led_blink1 โดยส่ง LED_PIN ไปเป็นพารามิเตอร์
// Call the led_blink1 function with LED_PIN as the parameter.
led_blink1( LED_PIN );
}
void led_blink1( int pin )
{
// ตั้งค่า pin ที่รับเข้ามาเป็น HIGH (เปิด LED)
// Output HIGH to the specified pin (turn the LED on).
digitalWrite( pin, HIGH );
// หน่วงเวลาประมาณ 500 มิลลิวินาที ตามที่กำหนดใน DELAY_MS
// Delay for 500 milliseconds as defined by DELAY_MS.
delay( DELAY_MS );
// ตั้งค่า pin ที่รับเข้ามาเป็น LOW (ปิด LED)
// Output LOW to the specified pin (turn the LED off).
digitalWrite( pin, LOW );
// หน่วงเวลาประมาณ 500 มิลลิวินาที ตามที่กำหนดใน DELAY_MS
// Delay for 500 milliseconds as defined by DELAY_MS.
delay( DELAY_MS );
}