Ejemplo n.º 1
0
draw_polygon(6, 50)
m.penup()

Command line usage

You can also control the mirobot from the command line. Make sure you have Python 2.7 or higher installed on your system, and have installed the mirobot package:

easy_install mirobot 

Example usage

from mirobot import Mirobot

m = Mirobot()

m.autoConnect("Mirobot-ed4f") 		# Use the real name of the mirobot

m.beep()

m.forward(100)

m.disconnect()

m.autoConnect("Mirobot-056d") 		# Use a different real name of a mirobot

m.beep()

m.forward(100)

m.disconnect()
Ejemplo n.º 2
0
# choose the Mirobot to connect to
if len(sys.argv) > 1:
  host = sys.argv[1]
else:
  host = 'local.mirobot.io'

# connect to Mirobot - there are a few different ways of doing this

# Use the host we specified on the command line
#mirobot = Mirobot(host, debug=True)

# Create a Mirobot instance
mirobot = Mirobot(debug=True)
# Autoconnect to a Mirobot on our network (there can be only one)
mirobot.autoConnect()

# Get a menu so we can select which Mirobot to connect to
#mirobot.autoConnect(interactive=True)

# Specify the id of the Mirobot we want to connect to
#mirobot.autoConnect(id='Mirobot-abcd')

print("Mirobot version: %s" % mirobot.version)

# set up error handling
mirobot.errorNotify(on_error)

mirobot.forward(100)
mirobot.right(90)
mirobot.back(100)