![](https://i.lnwfile.com/_/i/_raw/j5/ad/kt.jpg)
int ldr = 0; //analog pin to which LDR is connected
int ldr_value = 0; //variable to store LDR values
void setup()
{
Serial.begin(9600); //start te serial monitor
}
void loop()
{
ldr_value = analogRead(ldr); //reads the LDR values
Serial.println(ldr_value); //prints the LDR values to serial monitor
delay(50); //wait
}
LDR เป็นตัวต้านทานที่ปรับค่าได้ตามความเข้มของแสง LDR เราสามารถใช้ Arduino
อ่านค่าความต้านทานที่เปลี่ยนแปลงตามความเข้มของแสงเพื่อนำไปใช้งานที่ต้องการได้ โดยค่าที่อ่านได้เป็นแบบ อะนาล็อก
https://www.arduinoall.com/product/544/%E0%B8%8A%E0%B8%B8%E0%B8%94%E0%B8%97%E0%B8%94%E0%B8
%A5%E0%B8%AD%E0%B8%87%E0%B8%AD%E0%B9%88%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B9%88%E0%B8%B2%E0%B8
%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%A1%E0%B9%81%E0%B8%AA%E0%B8
%87-ldr
ความคิดเห็น
แสดงความคิดเห็น