def main(): servos = ServoDriver() inter = 2 while (True): servos.move(0, -90) time.sleep(inter) servos.move(0, 90) time.sleep(inter)
def main(): # identify global variables that we will access in this function global servos, sb # create an instance of LEDStrip object - pass number of pixels and link to spi connection servos = ServoDriver() servos.continous(0) servos.calibrateCont(0, 8150) # set spacesb name and create spacesb object sbName = ("Servo Control " + str(random.randint(0,2000))) sb = spacebrew.SpaceBrew(sbName, server=args.server) # register all of the subscription channels sb.addSubscriber("rotate", "boolean") sb.addSubscriber("position", "range") # associate a callback function to each subscription channel sb.subscribe("rotate", rotate) sb.subscribe("position", position) # connect to spacesb sb.start() print "App is running and conected to Spacebrew name is ", sbName
def main(): servos = ServoDriver() inter = 2 while (True): servos.move(0, -90) time.sleep(inter) servos.move(0, 90) time.sleep(inter)