You can use a Camera in ARC as a button without any external code. I created a custom multicolor named "Dark" and set it a orange/red range and I set it to the maximum size for detection. This is what worked best for me as I discovered the orange/red color range was reflected off my hand as it moved toward the camera to block the view.
I started out using the darkest shade of blue possible but that color did not perform as well for me. I encourage you to experiment as skin tone, lighting conditions and even the type of camera will very from user to user.
Below is my script which I named CamBlocked It only looks for the $CameraObjectColor value to change and so this scripts acts as a sort of "hair trigger".
#updated 7/21/14
$CameraObjectColor = ""
:Start
IF ($CameraObjectColor = "Dark")
ControlCommand("Bender Sounds", Track_19)
sleep(500)
ENDIF
$CameraObjectColor = ""
sleep(500)
goto(start)
The line below is the action I have chosen to perform when my "Dark" multicolor object is detected.
ControlCommand("Bender Sounds", Track_19)
Video Tutorial:
Here is an alternative take on the script. Rich's modified script uses the WaitForChange function and $CameraIsTracking value. My tests showed that I had to wave my hand slowly more closely in front of the camera for 1-3 seconds in order to trigger the event.
#from Rich 7/21/2014
$CameraObjectColor = ""
WaitForChange($CameraObjectColor)
:Start
IF ($CameraObjectColor = "Dark")
ControlCommand("Bender Sounds", Track_19)
EndIf
WaitForChange($CameraIsTracking)
$CameraObjectColor = ""
WaitForChange($CameraObjectColor)
Goto(start)
If you test the two scripts, please let us know the results.
Thank You, Justin. You are always coming up with good stuff to know.
Did you like how Bender kept interrupting, LOL. My next goal is a voice command "Shut Up!"
Great tutorial and creative use of the camera!
This is really great Justin. I can see how this can be used many ways. BTW you got a good video voice and do a great job producing this stuff. Very easy to follow despite Bender giving you a hard time.
Great video Justin ! This is what I call a very nice contribution to EZ-Robot ! Interesting and a great tutorial, thank you very much for sharing.
Great tutorial! Even better, I loved Bender. I was cracking up through the tutorial.
Thank you for all the positive feedback! This encourages me to keep producing tutorials.
Justin, dude... yes more videos.... you're one of the smartest guys on here... I learn a lot from you.... Unrelated.... here's a laugh.... I am "trying" to teach my self Python because I am jealous of a bunch of you guys knowing higher programming languages.... I love ARC and ez robot (lord knows I gave them enough of my money), but I just bought a raspberry pi and I want to lean more programming than just clicking a mouse...