Okay. I have not really had time to look at it before now.
I keep getting this error when i try to verify the project?
sketch_apr27b:31: error: expected unqualified-id before 'else'
expected unqualified-id before 'if'
My current code:
// Simple Oak PIR example
#define PIR_Out 5 // On Oak pin 5
#define Oak_LED 1 // Onboard LED pin
void setup()
{
pinMode(PIR_Out, INPUT);
pinMode(Oak_LED, OUTPUT);
digitalWrite(Oak_LED, LOW); // Turn Off onboard LED
// Serial.begin(9600);
// Serial.println("Warming up...");
delay(10000); // Ten seconds
}
void loop()
{
if (digitalRead(PIR_Out) == HIGH) {
digitalWrite(Oak_LED, HIGH);
}
else {
digitalWrite(Oak_LED, LOW);
}
delay(200); // Adjust delay as needed
}
if (digitalRead(PIR_Out) == HIGH) {
digitalWrite(Oak_LED, HIGH);
//is the sensor output high when there is motion? if not, move the publish line to the 'else' block
Particle.publish("motion-detected");
}
else {
digitalWrite(Oak_LED, LOW);
}