so am using an Arduino Uno Rev3, and based on my experience with C++, the coding is basically the same. I have yet to meet differences, however it has been a while since I've used C++. If you have experience with either, state which and what I'm doing wrong! any help would be great! Thanks:
NOTE: the Time.h and TimeAlarms.h libraries are Arduino native libraries (I believe) and info on them can be found on arduino sites and forums.
SO, I am trying to work with the function movementDelay() and it isn't working.
definition:
void movementDelay(boolean thirtyMinDelay)
{
digitalWrite(7,LOW);//turn off the lights of no movement within
//30 minutes.
thirtyMinDelay = false;
}
the error I am getting is:
PIR.ino: In function 'void loop()':
PIR:26: error: invalid use of void expression
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <Time.h>
#include <TimeAlarms.h>
//senses whether or not the PIR sensor senses movement. It returns either a 5v signal or nothing, respectively.
boolean senseMovement = digitalRead(12);
//Serial.print("sense Movement");
//Serial.println(senseMovement);
//read in light signal from photoresistor. value from 0 to 1023 (0 brightest light level and 1023 is almost utter darkness.
if (senseMovement == true /*&& thirtyMinDelay == false*/)
{
digitalWrite(7,HIGH);//turn the lights on.
thirtyMinDelay = true;
Alarm.timerOnce(60,movementDelay(thirtyMinDelay));//delays shutting off the lights for one minute upon sensing movement.
}
int lightLevel = analogRead(0);
//Serial.print("light level:");
//Serial.println(lightLevel);
}
void movementDelay(boolean thirtyMinDelay)
{
digitalWrite(7,LOW);//turn off the lights if no movement within
//1 minute.
thirtyMinDelay = false;
}