Asked
— Edited

I'm having a headache trying to comparing time. I have a variable $CustomerTime . It holds the last time motion was detected in the customer area. My plan is to have my robot look like he has fallen asleep. So I have the current time $time being stuffed into $CustomerTime each time motion is detected. So I want the robot to go to sleep when there has not been any motion in the last 10 minuets. I have the sleep and wake scripts working fine. But this comparing time is a pain.
If this were a business critical application, you would also have to account for year, month, and day, but I dont think your robot is going to take down your business. For example, if it were Dec 31, 2015 11:59:00 PM and you added 10 minutes, it would affect month, day, year, and hour.
I think the example provided would be good enough unless you want to spend the time accounting for all of these things. The example I gave you handles all of these situations.
Ok here is what I have come up with:
d.cochran ,
No its not a mission critical job my rot is doing. He is just greeting the customer and going over our rates. The robots job is to keep the customer entertained until I can get from the back of my shop to the front where the customer area is.
This portion of the project is to make my robot look as if he has gone to sleep after say 10 min. of no motion. So what he will do is turn on 2 relays. These relays turn off his eyes. Then we stop motion tracking on the cam only. The pir's will keep right on going. The speech is also paused. Then as soon as motion is detected from the PIR then he wakes up greets the customer and keeps them busy for a bit.
I understand. I have worked for a very long time as a business developer so I guess I just account for these things when I code. All good and I am glad you found an answer.
I've been away the last few days so I haven't had a chance to post this until now. Here's a couple of scripts I've been using, they were mostly written by Rich. It monitors motion thru a PIR and when there hasn't been any motion for 100 sec (you can set that for what ever you want) the robot powers down or it can do what ever you want. When motion is detected it powers up again and the monitor starts over again. Monitor
Low Power Monitoring
d.cochran and JustinRatliff,
Thanks for all your help. Here is the completed functioning script. Boy I learned a few things on this one. Mainly that you should save your work OFTEN. I had a few hours into it and everything was working really well then I made one change and ARC crashed and so did my work. Lockley had some of it paste3d into note pad. But it was still a few hours to get it back. But at last it works just fine.