def __init__ (self, comPort = 3, width = 250, height = 250, speed = 0.5, scale = 0.5, lookX = 0, lookY = 1): #set global variables self.Speed = speed self.__Scale = scale self.__TowardsX = lookX self.__TowardsY = lookY self.__MidpointX = width / 2 self.__MidpointY = height / 2 multiplyBy = int(1.0 / scale) multiplyBy = int(1.0 / scale) self.Plot = [[MemoryType.Unknown] * width * multiplyBy for col in range(height * multiplyBy)] self.__MidpointX *= multiplyBy self.__MidpointY *= multiplyBy Myro.init("COM" + str(comPort))
import Myro Myro.init() pic = Myro.takePicture() Myro.show(pic) Myro.robot.backward(1, 1) Myro.robot.forward(1, 1) Myro.robot.beep(1, 440) Myro.robot.beep(1, 440, 880) Myro.robot.forward(.5, 2) Myro.robot.backward(.5, 2) print(Myro.robot.get("all")) print(Myro.robot.getAll()) print(Myro.robot.getBattery()) print(Myro.robot.getBlob()) # print(Myro.robot.getBright()) print(Myro.robot.getConfig()) print(Myro.robot.getData()) print(Myro.robot.getIR()) print(Myro.robot.getIRMessage()) print(Myro.robot.getInfo()) print(Myro.robot.getLight()) print(Myro.robot.getLine()) print(Myro.robot.getName()) # print(Myro.robot.getObstacle()) print(Myro.robot.getPassword()) print(Myro.robot.getStall()) Myro.robot.motors(.5, .5) Myro.robot.move(1, 1) Myro.robot.move(-1, -1)
# # Calico - Scripting Environment # # Copyright (c) 2011, Doug Blank <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # $Id: $ import Myro Myro.init("/dev/rfcomm1") Myro.robot.beep(.5, 784) Myro.robot.beep(.5, 880) Myro.robot.beep(.5, 698) Myro.robot.beep(.5, 349) Myro.robot.beep(.5, 523)