
上QQ阅读APP看书,第一时间看更新
Wiring connection
With a wiring connection, we can connect the LDR sensor module and a LED to the RPi:

The wiring connections are as follows:
- wiringPi pin 8 of the RPi is connected to the D0 pin of the LDR sensor module
- Physical pin 2 of the RPi is connected to the Vcc pin of the LDR sensor module
- Physical pin 6 of the RPi is connected to the Gnd pin of the LDR sensor module
- wiringPi pin 0 is connected to the positive pin of the LED
- Physical pin 14 is connected to the negative pin of the LED
Now that we have connected the LDR sensor module and LED to the RPi, let's write the program to turn the LED on/off by taking inputs from the LDR sensor.