<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Example 2</title><link>https://sourceforge.net/p/ksr10usbpython/wiki/Example%25202/</link><description>Recent changes to Example 2</description><atom:link href="https://sourceforge.net/p/ksr10usbpython/wiki/Example%202/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 24 Jul 2012 14:13:53 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ksr10usbpython/wiki/Example%202/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Example 2 modified by Niels Bosboom</title><link>https://sourceforge.net/p/ksr10usbpython/wiki/Example%25202/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,7 +1,7 @@
 Example 2
 ---------
 
-In this example the robot arm is controlled by windows speech recognition.
+In this example the robot arm is controlled by windows speech recognition. You'll first need to download the [speech](http://pypi.python.org/pypi/speech/) module.
 
 - - - - - -
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Niels Bosboom</dc:creator><pubDate>Tue, 24 Jul 2012 14:13:53 -0000</pubDate><guid>https://sourceforge.net39f2279c29fec5bb29878f7df51fe83820e5a616</guid></item><item><title>WikiPage Example 2 modified by Niels Bosboom</title><link>https://sourceforge.net/p/ksr10usbpython/wiki/Example%25202/</link><description>Example 2
---------

In this example the robot arm is controlled by windows speech recognition.

- - - - - -

~~~~
#!/usr/bin/python

import ksr10
import speech
import time

def response(phrase, listener):
    # speech.say("You said %s" % phrase)
    print phrase
    if phrase.lower() == "turn off":
        listener.stoplistening()
    if phrase.lower() == "lights":
        ksr.lights()
    
    
    if phrase.lower() == "stop":
        ksr.stop()
    
    # move shoulder
    if phrase.lower() == "shoulder up":
        ksr.move("shoulder","up")
        time.sleep(.5)
        ksr.stop()
    if phrase.lower() == "shoulder down":
        ksr.move("shoulder","down")
        time.sleep(.5)
        ksr.stop()
    # move base
    if phrase.lower() == "base left":
        ksr.move("base","left")
        time.sleep(.5)
        ksr.stop()
    if phrase.lower() == "base right":
        ksr.move("base","right")
        time.sleep(.5)
        ksr.stop()
    # move wrist
    if phrase.lower() == "wrist up":
        ksr.move("wrist","up")
        time.sleep(.5)
        ksr.stop()
    if phrase.lower() == "wrist down":
        ksr.move("wrist","down")
        time.sleep(.5)
        ksr.stop()
    # move elbow
    if phrase.lower() == "elbow up":
        ksr.move("elbow","up")
        time.sleep(.5)
        ksr.stop()
    if phrase.lower() == "elbow down":
        ksr.move("elbow","down")
        time.sleep(.5)
        ksr.stop()
    # move elbow
    if phrase.lower() == "grip open":
        ksr.move("grip","open")
        time.sleep(.2)
        ksr.stop()
    if phrase.lower() == "grip close":
        ksr.move("grip","close")
        time.sleep(.2)
        ksr.stop()
    
if __name__ == '__main__':
    
    # create a robot arm object
    ksr = ksr10.ksr10.ksr10_class()
    
    print "Start listening..."
    listener = speech.listenforanything(response)
    
    while listener.islistening():
        time.sleep(10)
        print ".",
~~~~~    </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Niels Bosboom</dc:creator><pubDate>Tue, 24 Jul 2012 13:58:55 -0000</pubDate><guid>https://sourceforge.net416d4f17527f9845265676d01262f859345accd8</guid></item></channel></rss>