1. The LED is protected by the cylindrical shadow, and the photosensitive receiving tube is used to detect the current status of the RPI-1031.
2. When the RPI-1031 rotates to the state (p1) as shown in the figure, the LED is shaded; the two photosensitive receiving transistors cannot receive light; they will be off and output low level; two GPIO ports Both output low level.
3. When the RPI-1031 rotates to the state shown in Figure 2 (p2), one of the photosensitive transistors is shielded, and only the light emitted by the LED can be received by the other; this means that the above photosensitive transistor is turned on, and the side The phototransistor is disconnected; then the two GPIO port outputs output high level and low level respectively.
4. When the RPI-1031 rotates to the state shown in Figure 3 (p3), the lampshade will not be shaded; the diode will emit light, two phototransistors can receive light, and then everything will light up, two GPIO ports Output high level.