示例#1
0
import piplates.MOTORplate as MOTOR
import RPi.GPIO as GPIO
import time
import os
import string
from Tkinter import *
import tkFont

print MOTOR.getID(0)

#flush out any old interrupts
#dummy = MOTOR.getINTflag0(1)
#intFLAG=0
#intITS=0

#def moveDone(channel):
#    global intBITS, intFLAG
#    intBITS=MOTOR.getINTflag0(0)
#    intFLAG=1

MOTOR.RESET(0)

#configure steppers A and B for homing function
MOTOR.stepperCONFIG(0, 'a', 'ccw', 'M8', 100, 0)
MOTOR.stepperCONFIG(0, 'b', 'ccw', 'M8', 100, 0)

#move steppers A and B towards switches
MOTOR.stepperJOG(0, 'a')
MOTOR.stepperJOG(0, 'b')

#GPIO.setmode(GPIO.BCM)
示例#2
0
        direction=toggle_direction(direction)
        time.sleep(1)
        sync_config(direction,500,1)
        sync_move(1500)
        counter+=1
        
        
#GPIO.setmode(GPIO.BCM)
#GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#GPIO.add_event_detect(22, GPIO.FALLING, callback=moveDone)
#allow interrupts when a motor stops
#MOTOR.enablestepSTOPint(0,'a')
#MOTOR.enablestepSTOPint(0,'b')
#MOTOR.intEnable(0)
        
print MOTOR.getID(1)  
 
dummy=MOTOR.getINTflag0(1)  #flush out any old interrupts
intFLAG=0
intITS=0

direction=1

sync_config(direction,200,0)
#sync_jog()

flag=0
counter=0
cycles=0
sync_move(1)
while (counter<cycles):