[Lab] PIR, IRF540, PN2222, LED Strip, Arduino
Bruce Harding
bsharding at rogers.com
Sat Mar 17 20:28:32 EDT 2018
The breadboard is only proof out the concept.
Bruce
On Sat, Mar 17, 2018, 8:23 PM Darcy Whyte, <darcy at inventorartist.com> wrote:
> 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/20180318/93df9f93/attachment.html>
More information about the Lab
mailing list