Fix some non-ASCII character
Mistakes when translated comment from Chinese into English
This commit is contained in:
@@ -33,11 +33,11 @@ def servoWrite(angle): # make the servo rotate to specific angle (0-180 deg
|
||||
|
||||
def loop():
|
||||
while True:
|
||||
for dc in range(0, 181, 1): #make servo rotate from 0° to 180°
|
||||
for dc in range(0, 181, 1): #make servo rotate from 0 to 180 deg
|
||||
servoWrite(dc) # Write to servo
|
||||
time.sleep(0.001)
|
||||
time.sleep(0.5)
|
||||
for dc in range(180, -1, -1): #make servo rotate from 180°to 0°
|
||||
for dc in range(180, -1, -1): #make servo rotate from 180 to 0 deg
|
||||
servoWrite(dc)
|
||||
time.sleep(0.001)
|
||||
time.sleep(0.5)
|
||||
|
||||
@@ -22,7 +22,7 @@ def moveOnePeriod(direction,ms):
|
||||
for j in range(0,4,1): #cycle for power supply order
|
||||
for i in range(0,4,1): #assign to each pin, a total of 4 pins
|
||||
if (direction == 1):#power supply order clockwise
|
||||
GPIO.output(motorPins[i],((CCWStep[j] == 1<<i) and GPIO.HIGH orGPIO.LOW))
|
||||
GPIO.output(motorPins[i],((CCWStep[j] == 1<<i) and GPIO.HIGH or GPIO.LOW))
|
||||
else : #power supply order anticlockwise
|
||||
GPIO.output(motorPins[i],((CWStep[j] == 1<<i) and GPIO.HIGH or GPIO.LOW))
|
||||
if(ms<3): #the delay can not be less than 3ms, otherwise it will exceed speed limit of the motor
|
||||
@@ -39,9 +39,9 @@ def motorStop():
|
||||
|
||||
def loop():
|
||||
while True:
|
||||
moveSteps(1,3,512) #rotating 360° clockwise, a total of 2048 steps in a circle, namely, 512 cycles.
|
||||
moveSteps(1,3,512) #rotating 360 deg clockwise, a total of 2048 steps in a circle, namely, 512 cycles.
|
||||
time.sleep(0.5)
|
||||
moveSteps(0,3,512) #rotating 360° anticlockwise
|
||||
moveSteps(0,3,512) #rotating 360 deg anticlockwise
|
||||
time.sleep(0.5)
|
||||
|
||||
def destroy():
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
########################################################################
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
#class Key:Define some of the properties of Key
|
||||
#class Key:Define some of the properties of Key
|
||||
class Key(object):
|
||||
NO_KEY = '\0'
|
||||
#Defines the four states of Key
|
||||
|
||||
@@ -26,4 +26,5 @@ if __name__ == '__main__': #Program start from here
|
||||
print "Program is starting ... "
|
||||
try:
|
||||
loop()
|
||||
except KeyboardInterrupt: #When 'Ctrl+C' is pressed, exit the program. GPIO.cleanup()
|
||||
except KeyboardInterrupt: #When 'Ctrl+C' is pressed, exit the program.
|
||||
GPIO.cleanup()
|
||||
|
||||
Reference in New Issue
Block a user