We’re going to replicate the AND gate using an Arduino. To make the circuit interesting, we’re going to use a photocell to replace one of the pushbutton switches from Figure 6-1. In Figure 6-6, we see the Arduino AND Logic Gate, with the LED turned off. Placing a piece of tape over the photocell (to allow no light into it, thus simulating nighttime) will make input pin D4 TRUE for the Arduino microcontroller. Pressing the pushbutton switch allows input pin D3 to become TRUE. With both inputs TRUE, the green LED turns on, as shown in Figure 6-7.
Figure 6-8 shows the Fritzing wiring diagram to use for building the Arduino AND Logic Gate. As shown in Figures 6-1, 6-7, and 6-8, you can build the Arduino AND Logic Gate on a MakerShield. The MakerShield makes the project portable so that you can carry it to show family and friends the basic logic gate used in computers, cell phones, robotics, and other smart electronic devices.
Figure 6-6. The Arduino AND Logic Gate with LED turned off
Figure 6-7. The Arduino AND Logic Gate with LED turned on
Figure 6-8. The Arduino AND Logic Gate Fritzing wiring diagram
TECH NOTE
The flat side of an LED is the negative pin.
Leave a Reply