Chapter 4: Measuring the Amount of Light with a Photoresistor
This chapter focuses on how to connect a photoresistor, an electronic component that measures the amount of light from the environment, to an input port of both the Blue Pill and Curiosity Nano microcontroller boards. In this chapter's exercise, we will analyze with a photoresistor whether a plant receives enough light.
In this chapter, we are going to cover the following main topics:
- Understanding sensors
- Introducing photoresistors
- Connecting a photoresistor to a microcontroller board port
- Coding the photoresistor values and setting up ports
- Testing the photoresistor
By the end of this chapter, you will have learned how to connect an analog sensor to a microcontroller board, and how to analyze analog data obtained from a photoresistor. The knowledge and experience learned in this chapter will be useful in other chapters that require the use of a sensor.