<div dir="ltr"><div><div><div><div><div><div><div>Hello,<br><br>I'm trying to get the
pinning right for a project where a PIR triggers a LED strip to turn
on. I'm having real trouble getting the pinning on the breadboard
right. If someone is willing to take a look at it I'd be grateful. Beer
or coffee on me.<br><br></div>I'm using:<br><br></div>12v 3A power supply<br></div>PIR<br></div>IRF540 Mosfet<br></div>PN2222 Transistor<br></div>1m Warm/White LED Strip<br></div>Arduino Uno<br clear="all"><div><div><div><div><div><div><div><div><br><br></div><div>Code:<br><br>//constants<br>const int ledPin = 5;<br>const int sensorPin = 4;<br>const long stayOnPeriod = 900; // length of time to stay on (in milliseconds)<br><br>//variables<br>unsigned long turnOffTime = millis(); //Start with the led turned off<br><br>void setup() {<br> pinMode(ledPin, OUTPUT);<br> pinMode(sensorPin, INPUT);<br>}<br><br>void loop() {<br> // check if the sensor is detecting then increase the time to stay on.<br> if (digitalRead(sensorPin) == HIGH)<br> {<br> turnOffTime = millis() + stayOnPeriod;<br> }<br> <br> if (turnOffTime > millis())<br> {<br> digitalWrite(ledPin, HIGH);<br> }<br> else<br> {<br> digitalWrite(ledPin, LOW);<br> }<br>}</div></div></div></div></div></div></div></div><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span>====<br>bruce<div><a href="http://faintfuzzies.ca" target="_blank">faintfuzzies.ca</a></div></span></div></div>
</div>