I would like for the system to loop to read for input from one of the six infrared sensors and activate its respective relay for 3 -5 seconds. For example, sensor #1 will activate relay #1, when it detects motion. My first draft of my code is below. please read through and try to give feedback and feasibility.
I am doing this project for 1st year engineering class
final_code.ino (3.49 KB)
More people will see your code if you post it in accordance with the forum guidelines in the how to use this forum sticky.
Your code will not compile. For one, you did not declare inputpin6.
Pin 1 on most Arduino boards is the hardware serial TX pin. If you use Serial you can't use pin 1 for GPIO.
val2 = LOW; / set all values for input low to avoid other relays
// (2 slashes) for comments
When you start numbering variables it is time to consider using arrays. That will make your code more compact.