Arduino R4 DIM led
บทความ เกี่ยวกับทดลอง Code คำสั่ง DIM LED คือการจากสัญญา PWM เพื่อให้ LED แสดงการ หรี่แสง ซึ่งการทำงานจะ จ่ายพลังงานไฟฟ้า ในรูปของ PWM โดยการใช้ Arduino R4 Wiring Led รายการอุปกรณ์ 1. Arduino R4 Board https://s.shopee.co.th/7V9WJbnx0s 2.Led 3.Resisteor 220 Orm libraey - Code Program // ***LED fade #define LED_PIN 9 int brightness = 0; int Dim_step = 5; void setup() { pinMode(LED_PIN,OUTPUT); } void loop() { analogWrite(LED_PIN,brightness); brightness = brightness + Dim_step; if(brightness =255){ Dim_step = -Dim_step; } delay(30); } แสดงผล