Hands-On Robotics Programming with C++
上QQ阅读APP看书,第一时间看更新

Smart light – working with digital sensor

After writing our first C/C++ program for Raspberry Pi, we can now write a program that will take input from an LDR sensor and turn the LED on or off. For this project, you will need the following hardware components:

  • 1 LDR sensor module
  • 1 LED
  • Raspberry Pi
  • 5 female-to-female connecting wires

First, let's explore how the LDR sensor works.