예제 #1
0
  ON_PI = 0

LS = [LimitSwitch(11), LimitSwitch(12), LimitSwitch(13), LimitSwitch(15), LimitSwitch(35), LimitSwitch(37), LimitSwitch(38)]
RLY = [Relay(18), Relay(22), Relay(7)]

  
  
mh = [0, 0]

if (ON_PI):
  mh = [ Adafruit_MotorHAT(0x60), Adafruit_MotorHAT(0x61) ]

if (len(sys.argv) > 1):
  if sys.argv[1] == "--testMotor":
    testAxis = Axis()
    testAxis.attach(Motor(mh[0], 1, 0), None, None)
    testAxis.attach(Motor(mh[0], 2, 0), None, None)
    testAxis.attach(Motor(mh[1], 1, 0), None, None)
    testAxis.attach(Motor(mh[1], 2, 0), None, None)
    testAxis.homeAxis()
    raw_input("Press Enter to quit...")
    testAxis.stop()
    sys.exit()
  else:
    print "Unrecognized parameter"
    sys.exit(2)
  
feeder = Feeder(Motor(mh[0], 2))
dropper = Dropper(RLY[0], LimitSwitch(16)) # Note, pin 16 is the Photocell, not a physical limit switch