voicecommand -e

In a terminal, open the Voice Command config file by typing the command



Add the following lines to the config file*:

light one on==tts "Yes, sir." && gpio write 0 1 && sleep 1 && gpio write 0 0

light one off==tts "Yes, sir." && gpio write 1 1 && sleep 1 && gpio write 1 0

light two on==tts "Yes, sir." && gpio write 3 1 && sleep 1 && gpio write 3 0

light two off==tts "Yes, sir." && gpio write 4 1 && sleep 1 && gpio write 4 0

light three on==tts "Yes, sir." && gpio write 5 1 && sleep 1 && gpio write 5 0

light three off==tts "Yes, sir." && gpio write 6 1 && sleep 1 && gpio write 6 0

You can probably guess what each line of this code does. When the phrase before the double equals sign is detected (e.g. "light one on") the code after the double equals sign executes. You can change each phrase to whatever suits your needs (e.g. "TV on", "desk light on" etc). tts is "text to speech" and will make your personal robot assistant respond appropriately (Steve's default is "Yes sir", I prefer something a little more ego-maniacal like "At your command, master."). The rest is the digital equivalent of pushing and releasing a button on the remote:

gpio write 0 1: set GPIO pin 17 to HIGH (ultimately sending a 5V signal to the remote, equivalent to pushing the button). See note below about pin numbering convention.

set GPIO pin 17 to HIGH (ultimately sending a 5V signal to the remote, equivalent to pushing the button). See note below about pin numbering convention. sleep 1 : hold the pin HIGH for one second (equivalent of holding the button down)

: hold the pin HIGH for one second (equivalent of holding the button down) gpio write 0 0: set the pin back to LOW (equivalent of releasing the button)

light one on==tts "Yes, sir." && gpio -g write 17 1 && sleep 1 && gpio -g write 17 0

light one off==tts "Yes, sir." && gpio -g write 18 1 && sleep 1 && gpio -g write 18 0

light two on==tts "Yes, sir." && gpio -g write 22 1 && sleep 1 && gpio -g write 22 0

light two off==tts "Yes, sir." && gpio -g write 23 1 && sleep 1 && gpio -g write 23 0

light three on==tts "Yes, sir." && gpio -g write 24 1 && sleep 1 && gpio -g write 24 0

light three off==tts "Yes, sir." && gpio -g write 25 1 && sleep 1 && gpio -g write 25 0

Be careful to get the syntax right -primarilyimmediately before or after the double equals signs.Follow the on-screen directions to save the config file once you've added this code (to exit thento save).*Apparently WiringPi is compatible with two different numbering conventions - the Raspberry Pi GPIO pin numbers (17, 18 etc) or its own system that starts numbering the pins at 0. So, the following block of code will also work. You can use whatever convention you prefer.

I skipped using WiringPi pin 2 so I could stick with "pairs" of pins that were across from each other on the header for on/off (for the first two channels, at least). Somewhat arbitrary, and you can use different pins if you'd like. You can read about the reasoning behind the WiringPi convention here.