บทความ

กำลังแสดงโพสต์จาก ธันวาคม, 2025

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); } แสดงผล 

arduino R4 ต่อ DHT11

รูปภาพ
 เนื่อหา ใบบทนี้จะพูดถึงการเชื่อมต่อ sensor DHT 11 ด้วย Arduino R4  เพื่อ แสดง และวัดค่า ความชื้น Humidity and temperature  รูปแสดง Wiring Diagram รายการอุปกรณ์  1. Arduino R4 Board   https://s.shopee.co.th/7V9WJbnx0s 2.sensor kit DHT11  https://s.shopee.co.th/LgNJNmqn6 libraey 1.DHT sensor libraey by Adafruit Code Program  #include DHT.h #define DHT11_PIN 2 // กำหนด pin เชื่อมต่อ output ของ DHT11 DHT dht11(DHT11_PIN, DHT11); void setup() { Serial.begin(9600); dht11.begin(); // initializa the sensor } void loop() { // Delay 3 sec for loop program. delay(3000); // define valible for recive data float // read humidity float humidity = dht11.readHumidity(); // read temperature as Celsius float tempC = dht11.readTemperature(); // read temperature as Fahrenheit float tempF = dht11.readTemperature(true); // check if any reads failed // ถ้าค่า ใดค่าหนึ่ง ไม่ใช่ตัวเลข แสดงข้อความ Failed to read from DHT11 sensor! ...