
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.
Code:
Code:
Code:
As you can see I did not get vary far. I was stumbling over the hours vers min. In my variable $AssociateTime holds the hole time and not just the min, because it would be possible for the minuets to be less then the limit and yet have the hour gone over the limit. So I gues first I must compare hours then minuets. I'm thinking I will re doo my $AssociateTime and change that to $AssociateTimeHour and on $AssociateTimeMin . I will then compare the hours first and last the min. hhmmm.....
If you needed to go passed 60, you would need to incorporate the $hour variable, and that is very good catch David, if the time Motion was detected happened to be 50 or higher the logic of the script would fail, but it can be fixed with another variable by checking the hour.
Code:
Edited:
I added a less than hour check incase the time was 2300 hours
Code:
this allows the system to calculate the hour and minute calculation for you.
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.
Code:
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.
Monitor
Code:
Low Power Monitoring
Code:
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.
Code: