hi does anyone know how to tell the Arduino to ignore the values from a PIR sensor for the first 40 seconds
Put a delay() in setup()?
I tried it with delay but it still lights up the led on my other Arduino(sorry about the bother I am new to this)
pir.ino (841 Bytes)
Just POST the damn code.
#include <SoftwareSerial.h>
#include <XBee.h>
//Reads and analog sensor and displays the value
int sensePin = 0;
int ledPin = 9;
SoftwareSerial XBee(0,1);// pins of xbee(RX,TX)
void setup()
{delay(41000);}
{
//We don't need to specifiy sensor Pin as an input, since it defaults to that when we read it
//This is the default value, but we can set it anyways
analogReference(DEFAULT); //5V Reference on UNO
pinMode (ledPin,OUTPUT);//Setting the led pin as a output
//Allows us to listen to serial communications from the arduino
Serial.begin(9600);
XBee.begin(9600);
}
void loop()
{
int val = analogRead(sensePin);//telling the arduino to read the value of the sensor
if (val > 500)
{
digitalWrite (ledPin,HIGH);
digitalWrite (1,HIGH);
}
else
{
digitalWrite (ledPin,LOW);
digitalWrite (1,LOW);
}
delay (50);
}
That doesn't actually compile, does it?
09aadarsh:
it does compile.
Not as posted, it doesn't.
I get this error:
expected unqualified-id before '{' token
This } closes setup() so the rest is outside any function:
void setup()
{delay(41000);[b][color=red]}[/color][/b]
{