[Lab] PIR, IRF540, PN2222, LED Strip, Arduino
Darcy Whyte
darcy at inventorartist.com
Sat Mar 17 20:22:43 EDT 2018
Not sure who's coming to the hack613 meetup tomorrow but I wouldn't be
surprised if someone could help. I might be able to...
It's not clear what you want though. You mean making the circuit on a
breadboard?
--
Darcy Whyte
Art+ inventorArtist.com <http://inventorartist.com/> | Makerspace
hack613.com | Aviation rubber-power.com
Contact: *darcy at inventorArtist.com* <darcy at inventorArtist.com> |
613-563-3634 by appointment (no text)
On Sat, Mar 17, 2018 at 3:10 PM, Bruce Harding <bsharding at rogers.com> wrote:
> Hello,
>
> 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.
>
> I'm using:
>
> 12v 3A power supply
> PIR
> IRF540 Mosfet
> PN2222 Transistor
> 1m Warm/White LED Strip
> Arduino Uno
>
>
> Code:
>
> //constants
> const int ledPin = 5;
> const int sensorPin = 4;
> const long stayOnPeriod = 900; // length of time to stay on (in
> milliseconds)
>
> //variables
> unsigned long turnOffTime = millis(); //Start with the led turned off
>
> void setup() {
> pinMode(ledPin, OUTPUT);
> pinMode(sensorPin, INPUT);
> }
>
> void loop() {
> // check if the sensor is detecting then increase the time to stay on.
> if (digitalRead(sensorPin) == HIGH)
> {
> turnOffTime = millis() + stayOnPeriod;
> }
>
> if (turnOffTime > millis())
> {
> digitalWrite(ledPin, HIGH);
> }
> else
> {
> digitalWrite(ledPin, LOW);
> }
> }
>
>
> --
> ====
> bruce
> faintfuzzies.ca
>
> _______________________________________________
> Lab mailing list
> 1. subscribe https://artengine.ca/mailman/listinfo/lab
> 2. then email Lab at artengine.ca to send your message to the list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://artengine.ca/pipermail/lab/attachments/20180317/13a7ef5c/attachment.html>
More information about the Lab
mailing list