Everywhere I found seems so difficult to install, I put these most basic script there is….this script is great for controlling a robot from your mobile phone.
As long as you have set up any web server (Apache or Lighttpd) then it should just work, ready for you to build on…
Connect to this script via a web browser, ie 192.168.0.28/control.php
that shows one link, when clicked will run a php program by reloading the page and setting a variable, when it gets posted, it will filter into an IF function and run that code. Adding forms etc can add great value to your new robotics program…..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php function left(){ $hello = 'back'; $result = shell_exec('sudo python button1left.py ' . $hello); echo $result; } if (isset($_GET['hello'])) { left(); } ?> <a href='<?php echo $_SERVER['PHP_SELF'];?>?hello=true'>Run espeak</a> |
And then this for the button1left.py script
1 2 3 4 5 6 7 8 9 10 |
from subprocess import call swear = random.choice(['stupid', 'hippie', 'geek']) secret = random.choice(['sailor', 'student', 'doctor']) call(["espeak","-s155 -ven+18","I could become a " + swear + " " + secret]) import sys who = sys.argv[1] print "button1left Processed %s" % who |