
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,
Code:
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
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
Code:
Add in anything else you want to do on connection, i.e.
Code:
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
Code:
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.
Thanks again
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
I would like my robot to power down (servos) after a specified time of inactivity,
then when the PIR senses movement the robot will power up and run a script.
You will of course need to create a script called PowerUp and put in it what you want the robot to do when it wakes up from motion detected....
This topic may be of some assistance to you. It's not exactly what you are asking for but should put you on the right track in the right direction at least.
This just repeats over and over;
repeatUntil(1=2)
set(D11,OFF) #You might need this line as well, not sure
sleep(20)
$motion=getDigital(D11)
IF($motion=1) #pin went high
ControlCommand("Auto Position", AutoPositionFrameJump, "Wakeup")
Sleep(1000)
sayezb("i am awake now")
sleep(2000)
ControlCommand("Auto Position", AutoPositionFrameJump, "Rest")
endif
sleep(10000)
endRepeatUntil
Now I need to add a "timer" so that If the robot does nothing for X amount of time it will release all servos but continue to poll the PIR. Then when it senses motion it will power up do the above ONCE and then go back to "Timing" for the next event.
Thanks Rich I will start reading
Code:
Obviously it needs more to it as it doesn't actually do much other than count down but the idea is there. There are other methods too, the above may not be the best method (I didn't really think about it much) but it's a method that you can build on.
Basically it will count down for 1 minute with 1 second intervals. Throw the controlcommand, if, etc. either before or after the sleep (it doesn't really matter which side you put it).
Just an idea...
Also, it isn't a forever looping script so once $x did hit 60 (for any reason) the repeat loop would end and the script would stop. Hence why it needs to be part of a bigger script.
So here's where I'm at with this project, I've put some comments in so you can see what I'm trying to accomplish. Any and all help will be appreciated.
Code:
Thanks
PS. I would pay money to go to a course somewhere to learn EZ-Robot scripting!