前言
想必大家对“小夜灯”也有所耳闻,但此夜灯非彼夜灯,我这个“小夜灯”呢,是利用光敏电阻传感器和RGB LED灯模拟而成,当达到一定暗时自动开灯,在很光的时候就关灯,既省电又省钱。
下面就来介绍一下我的这个“小夜灯”吧
材料
Arduino uno x1
光敏电阻 x1
RGB LED灯 x1
电阻 x3
跳线
参考
1.Arduino使用光敏电阻实验:
https://blog.csdn.net/ling3ye/article/details/47099575
2.使用Arduino开发板点亮RGB全彩LED灯
https://www.yiboard.com/thread-1013-1-1.html?tdsourcetag=s_pcqq_aiomsg
接线方法
程序
#include <Wire.h>
int redPin= 7;
int greenPin = 6;
int bluePin = 5;
int Inten