- Fri Jun 05, 2009 6:24 pm
#74258
Hi Guys,
First off I have read this post and gotten nowhere.
At the minute I am running the code from the OP on that thread:
Note: Thats Pin 2, 10KOhm and signal on the one track. 10K Ohm goes to the +5V Rail..
My Problems:
When I power up the circuit + arduino everything the LED flashes real oddly..
The only way I can stabilise the circuit is by unplugging the PIR alarm(signal) wire for a few seconds.. Removing it and replacing it quickly won't work. It's like I have to let some capacitors drain on the PIR board..
My Question is simple. What am I doing wrong?? I must admit that I am pretty remedial when it comes to electronic circuits. I bought the arduino for the programming side of things really...
Any advice is greatly appreciated..
Thanks..
First off I have read this post and gotten nowhere.
At the minute I am running the code from the OP on that thread:
Code: Select all
Here is how I have wired up my PIR sensor..// variables
int PIRpin = 2; // PIR sensor's alarm pin ==> 10K ohm pull-up resistor ==> Digital Pin 2
int LEDpin = 11; // the LED pin to display output
int val = 0; // the value of the PIR sensor
// setup
void setup()
{
pinMode(PIRpin, INPUT); // the PIR sensor alarm is input
pinMode(LEDpin, OUTPUT); // the LED is output
digitalWrite(LEDpin, HIGH); // turn on the LED
delay(1000);
digitalWrite(LEDpin, LOW); // turn on the LED
delay(1000);
digitalWrite(LEDpin, HIGH); // turn on the LED
delay(1000);
digitalWrite(LEDpin, LOW); // turn on the LED
}
// code loop
void loop()
{
val = digitalRead(PIRpin); // read PIR & set value to variable
if (val == LOW)
{
digitalWrite(LEDpin, HIGH); // turn on the LED
}
else
{
digitalWrite(LEDpin, LOW); // turn off the LED
}
}
void flash()
{
digitalWrite(LEDpin, HIGH); // turn on the LED
delay(250);
digitalWrite(LEDpin, LOW); // turn on the LED
delay(250);
return;
}
Note: Thats Pin 2, 10KOhm and signal on the one track. 10K Ohm goes to the +5V Rail..
My Problems:
When I power up the circuit + arduino everything the LED flashes real oddly..
The only way I can stabilise the circuit is by unplugging the PIR alarm(signal) wire for a few seconds.. Removing it and replacing it quickly won't work. It's like I have to let some capacitors drain on the PIR board..
My Question is simple. What am I doing wrong?? I must admit that I am pretty remedial when it comes to electronic circuits. I bought the arduino for the programming side of things really...
Any advice is greatly appreciated..
Thanks..