Start with Part 1 of this assignment.
Click here for a video description of this assignment and the circuit/program.
In Part 1, you created a circuit that looked like this – please make a copy of it:
In part 2 you will do the following:
- add TWO LED’s to the above circuit. They should be different colors.
- write a program that will turn on the red LED if an object gets too close. If the object is farther away, the green LED will be on and red LED will be off.
You should be able to wire the LEDs independently. Here’s a resource to help you out: Arduino LED and program
Here’s a clue for how to setup your if/else statement to control the LEDs: use this sample code and put it INSIDE of the void loop at the bottom of the loop just above the last curly brace }.