Skip to content

Instantly share code, notes, and snippets.

@fxprime
Created June 4, 2025 07:03
Show Gist options
  • Save fxprime/6114981989e103aed6cbd8e11f319019 to your computer and use it in GitHub Desktop.
Save fxprime/6114981989e103aed6cbd8e11f319019 to your computer and use it in GitHub Desktop.
// ตัวอย่างปัญหาของ delay()
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000); // หยุดทำงานทุกอย่าง 1 วินาที!
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // หยุดอีก 1 วินาที
// ในขณะ delay() โปรแกรมไม่สามารถ:
// - อ่านเซนเซอร์
// - ตรวจสอบปุ่มกด
// - สื่อสารผ่าน Serial
// - ทำงานอื่นใดได้เลย
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment