Hi there, my class is trying to create motion sensor-controlled lights using an Arduino Uno and a PIR sensor. I have found projects such as this online, however we are trying to code it modeled off of the projects in the Arduino Project book. So far we have yet to make it work, and I'm not sure what we are doing wrong. Below is a sample of one of the codes my students came up with. The LED is attached to pin 3, the sensor is attached to pin 4. Why would this not work? Thank you!
I'm sorry, I posted that in a rush before leaving work and chose the wrong student's code. Here is a better example, where the pinModes are correct for the LED and the PIR, and the == is used.