
MovieMaker
USA
Asked
— Edited

I have tried every which a way and I cannot find a way to hook the PIR to the EZB. I have tried Analog,Digital, etc. I bought a dozen of these units - the ones with the TWO Potentiometers on the PC. You help would be appreciated.
Thanks,
Dave beat me to it. WaitForChange() would work nicer.
@Rich... Show off...




Wow, that was easy. I hooked up the PIR and ran the Loop code from Rich (thanks for your code as well Richard R) and my script ran when the PIR was triggered.
I put the script in "Script Manager" but with it there I can only run one script at a time.
My question now is - Where can I put the PIR script so that it is always running in the background so that when the PIR is triggered a script will run?
Thanks
My code and @Rich's code should run continuous unless the code you added causes the script to exit... You can run as many scripts at a time as you want...
You can run as many scripts in script manager at once as you like. My Ping Roam uses a lot of scripts and they run at the same time.
What I usually do with my projects is add a Script Manager control (sometimes more than one if I want an easy way to organise different script types but let's not over complicate it), add all scripts to that.
Assuming the PIR detection script is named "PIR Detect" and in Script Manager you just need to set it running on connection which is very simple...
Add a control, choose Scripting and choose EZ-Script (not script manager) Name the script "init" Add the following line
Add in anything else you want to do on connection, i.e.
or nothing if you prefer. Save it Next click on the cog/gear icon on the Connect control (top left) You should see 5 boxes for "Connection Established Cmd". Assuming your EZ-B is EZ-B 0 (the top one) click the pencil icon to the right of the top box Add the following code to the script
Click Save Click Save on the connection dialogue
Now whenever your EZ-B is connected it will run the init script. The init script will start the PIR detection script.
You could cut out some of the above however if you do it the way I describe it gives more scope for other init actions.
Man, you guys are great! I will try what you suggested Rich. I did make voice commands to start and stop the PIR sensing and that works good too.
Thanks again
So taking to PIR sensor a few steps further, I would like to do the following but really don't know where to start, so I'll put my Idea out there;
I would like my robot to power down after a specified time of inactivity, then when the PIR senses movement the robot will power up and run a script.
I current have the "Auto Release" in use as well as the PIR, which reacts to movement.
Any help would be appreciated, Thanks
When you mean power down do you mean the ezb too? Because the ezb will have to remain active in order to monitor the PIR... Other peripherals can be powered down by using relays to save power (e.g. like lights, motor controllers etc)