Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # External module imports
- from __future__ import division
- import RPi.GPIO as GPIO
- import time
- import pygame
- # Import the PCA9685 module.
- import Adafruit_PCA9685
- # Import pygame module.
- # import pygame
- # Initialise the PCA9685 using the default address (0x40).
- pwm = Adafruit_PCA9685.PCA9685()
- # GPIO Pin Definitons:
- beastStart = 5 # IR Module pin for start position for the Beast (character)
- beastShow = 6 # IR Module pin where the Beast (Character) would be at when he appears.
- beastShop = 13
- belleShow = 19 # IR Module pin where the Belle (Character) would be at when she appears.
- belleStart = 26 # IR Module pin for start position for Belle (character)
- screenStop = 21 # IR Module pin for the background.
- # PCA9685 Pin Definitions
- belleM_Left = 0 # PWM Pin to send to the Motor Driver.
- belleM_Right = 1 # PWM Pin to send to the Motor Driver.
- beastM_Right = 2 # PWM Pin to send to the Motor Driver.
- beastM_Left = 3 # PWM Pin to send to the Motor Driver.
- screen_Left = 4 # PWM Pin to send to the Motor Driver.
- screen_Right = 5 # PWM Pin to send to the Motor Driver.
- belleBody = 6
- belleArm = 7
- beastLeg = 9
- beastArm = 8
- gboxMotor = 10 # Servo for the gearbox - This is for the one with the motor
- gboxNMotor = 11 # Servo for the gearbox - This is for the one WITHOUT the motor.
- led_red = 12 # To send to High power LED Driver.
- led_green = 13 # To send to High power LED Driver.
- led_blue = 14 # To send to High power LED Driver.
- led_white = 15 # To send to High power LED Driver.
- # Configure min and max servo pulse lengths
- servo_min = 120 # Min pulse length out of 4096
- servo_max = 300 # Max pulse length out of 4096
- led_low = 0
- led_high = 3560
- gearBox_servoMin = 345 #TODO: Very important, pls change. 345 is engage
- gearBox_servoMax = 405 #TODO: 405 is disengage
- motorSpd = 1596
- # Pin Setup:
- GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme
- GPIO.setup(beastStart, GPIO.IN) # Button pin set as input w/ pull-up
- GPIO.setup(beastShop, GPIO.IN) # Button pin set as input w/ pull-up
- GPIO.setup(beastShow, GPIO.IN) # Button pin set as input w/ pull-up
- GPIO.setup(belleShow, GPIO.IN) # Button pin set as input w/ pull-up
- GPIO.setup(belleStart, GPIO.IN) # Button pin set as input w/ pull-up
- GPIO.setup(screenStop, GPIO.IN) # Button pin set as input w/ pull-up
- # This is to check if the song has completed playing.
- def checkifComplete(channel):
- while channel.get_busy(): # Check if Channel is busy
- pygame.time.wait(800) # wait in ms
- channel.stop() # Stop channel
- # NOTE: Servos work with these values:
- # Pulses are at a 50/60Hz interval
- # Pulse high vary between 1 to 2 miliseconds, i.e. centre should be 1.5ms
- # Helper function to make setting a servo pulse width simpler.
- def set_servo_pulse(channel, pulse):
- pulse_length = 1000000 # 1,000,000 us per second
- pulse_length //= 60 # 60 Hz
- print('{0}us per period'.format(pulse_length))
- pulse_length //= 4096 # 12 bits of resolution
- print('{0}us per bit'.format(pulse_length))
- pulse *= 1000
- pulse //= pulse_length
- pwm.set_pwm(channel, 0, pulse)
- # Set frequency to 60hz, good for servos.
- pwm.set_pwm_freq(60)
- # Alternatively specify a different address and/or bus:
- # pwm = Adafruit_PCA9685.PCA9685(address=0x41, busnum=2)
- print("Here we go! Press CTRL+C to exit")
- try:
- if __name__ == "__main__":
- music_file1 = "sounds/Na1.wav"
- music_file2 = "sounds/Shop1.wav"
- music_file3 = "sounds/Beast1.wav"
- music_file4 = "sounds/Shop2.wav"
- music_file5 = "sounds/Beast2.wav"
- music_file6 = "sounds/Shop3.wav"
- music_file7 = "sounds/Beast3.wav"
- music_file8 = "sounds/QZSing.wav"
- music_file9 = "sounds/Na2.wav"
- music_file10 = "sounds/DoorSound.wav"
- music_file11 = "sounds/Beast4.wav"
- music_file12 = "sounds/Belle1.wav"
- music_file13 = "sounds/Beast5.wav"
- music_file14 = "sounds/Belle2.wav"
- music_file15 = "sounds/Beast6.wav"
- music_file16 = "sounds/Belle3.wav"
- music_file17 = "sounds/Beast7.wav"
- music_file18 = "sounds/Belle4.wav"
- music_file19 = "sounds/Na3.wav"
- music_file20 = "sounds/Beast8.wav"
- music_file21 = "sounds/Belle5.wav"
- music_file22 = "sounds/Belle6.wav"
- music_file23 = "sounds/Belle7.wav"
- music_file24 = "sounds/Ambulance.wav"
- music_file25 = "sounds/DrChia.wav"
- music_file26 = "sounds/Beast9.wav"
- music_file27 = "sounds/Beast10.wav"
- music_file28 = "sounds/Na4.wav"
- music_file29 = "sounds/Shop4.wav"
- music_file30 = "sounds/Beast11.wav"
- music_file31 = "sounds/Shop5.wav"
- music_file32 = "sounds/neckCrack.wav"
- music_file33 = "sounds/Na5.wav"
- # set up the mixer
- freq = 44100 # audio CD quality
- bitsize = -16 # unsigned 16 bit
- channels = 2 # 1 is mono, 2 is stereo
- buffer = 2048 # number of samples (experiment to get right sound)
- pygame.mixer.init(freq, bitsize, channels, buffer)
- pygame.mixer.set_num_channels(128)
- pygame.mixer.init() # Initialize Mixer
- # Create sound object for each Audio
- myAudio1 = pygame.mixer.Sound(music_file1)
- myAudio2 = pygame.mixer.Sound(music_file2)
- myAudio3 = pygame.mixer.Sound(music_file3)
- myAudio4 = pygame.mixer.Sound(music_file4)
- myAudio5 = pygame.mixer.Sound(music_file5)
- myAudio6 = pygame.mixer.Sound(music_file6)
- myAudio7 = pygame.mixer.Sound(music_file7)
- myAudio8 = pygame.mixer.Sound(music_file8)
- myAudio9 = pygame.mixer.Sound(music_file9)
- myAudio10 = pygame.mixer.Sound(music_file10)
- myAudio11 = pygame.mixer.Sound(music_file11)
- myAudio12 = pygame.mixer.Sound(music_file12)
- myAudio13 = pygame.mixer.Sound(music_file13)
- myAudio14 = pygame.mixer.Sound(music_file14)
- myAudio15 = pygame.mixer.Sound(music_file15)
- myAudio16 = pygame.mixer.Sound(music_file16)
- myAudio17 = pygame.mixer.Sound(music_file17)
- myAudio18 = pygame.mixer.Sound(music_file18)
- myAudio19 = pygame.mixer.Sound(music_file19)
- myAudio20 = pygame.mixer.Sound(music_file20)
- myAudio21 = pygame.mixer.Sound(music_file21)
- myAudio22 = pygame.mixer.Sound(music_file22)
- myAudio23 = pygame.mixer.Sound(music_file23)
- myAudio24 = pygame.mixer.Sound(music_file24)
- myAudio25 = pygame.mixer.Sound(music_file25)
- myAudio26 = pygame.mixer.Sound(music_file26)
- myAudio27 = pygame.mixer.Sound(music_file27)
- myAudio28 = pygame.mixer.Sound(music_file28)
- myAudio29 = pygame.mixer.Sound(music_file29)
- myAudio30 = pygame.mixer.Sound(music_file30)
- myAudio31 = pygame.mixer.Sound(music_file31)
- myAudio32 = pygame.mixer.Sound(music_file32)
- myAudio33 = pygame.mixer.Sound(music_file33)
- # Create a Channel for each Audio
- myChannel1 = pygame.mixer.Channel(1)
- pwm.set_pwm(led_red, 0, led_high)
- # Audio Narration: The beginning.
- myAudio1.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file1)
- myChannel1.play(myAudio1)
- checkifComplete(myChannel1) # Check if Audio1 complete
- pwm.set_pwm(led_red, 0, led_low)
- pwm.set_pwm(led_white, 0, led_high)
- time.sleep(1)
- # Move beast to the shop scene
- # while time < 10:
- # pwm.set_pwm(beastLeg, 0, 200)
- # time.sleep(0.75)
- # pwm.set_pwm(beastLeg, 0, 400)
- # time.sleep(0.75)
- # pwm.set_pwm(beastM_Left, 0, motorSpd)
- pwm.set_pwm(beastM_Left, 0, 1024)
- pwm.set_pwm(beastArm, 0, servo_max)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(beastArm, 0, servo_min)
- pwm.set_pwm(beastLeg, 0, servo_min)
- time.sleep(0.75)
- pwm.set_pwm(beastArm, 0, servo_max)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(beastArm, 0, servo_min)
- pwm.set_pwm(beastLeg, 0, servo_min)
- time.sleep(0.75)
- pwm.set_pwm(beastArm, 0, servo_max)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(beastArm, 0, servo_min)
- pwm.set_pwm(beastLeg, 0, servo_min)
- time.sleep(0.75)
- pwm.set_pwm(beastArm, 0, servo_max)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(beastM_Left, 0, 0)
- # Insert Lelong Sound
- myAudio2.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file2)
- myChannel1.play(myAudio2)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # Beast thinking that this is a good deal
- myAudio3.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file3)
- myChannel1.play(myAudio3)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # Shopkeeper says 50 cents
- myAudio4.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file4)
- myChannel1.play(myAudio4)
- pwm.set_pwm(beastArm, 0, servo_min)
- time.sleep(0.75)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # Beast says here you go
- myAudio5.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file5)
- myChannel1.play(myAudio5)
- pwm.set_pwm(beastArm, 0, servo_max)
- time.sleep(0.75)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # Shopkeeper says thank you and have a nice day
- myAudio6.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file6)
- myChannel1.play(myAudio6)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # The beast says bye
- myAudio7.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file7)
- myChannel1.play(myAudio7)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # QZSong
- myAudio8.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file8)
- myChannel1.play(myAudio8)
- pwm.set_pwm(gboxMotor, 0, 345) #TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- pwm.set_pwm(screen_Left, 0, 1200)
- time.sleep(10)
- pwm.set_pwm(beastLeg, 0, servo_min)
- time.sleep(0.75)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(beastLeg, 0, servo_min)
- time.sleep(0.75)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(beastLeg, 0, servo_min)
- time.sleep(0.75)
- pwm.set_pwm(beastLeg, 0, servo_max)
- time.sleep(0.75)
- pwm.set_pwm(screen_Left, 0, 0)
- checkifComplete(myChannel1) # Check if Audio1 complete
- pwm.set_pwm(led_white, 0, led_low)
- # Narrator says interesting stuff
- myAudio9.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file9)
- myChannel1.play(myAudio9)
- # pwm.set_pwm(beastM_Right, 0, 1024)
- # pwm.set_pwm(beastArm, 0, servo_max)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_min)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_max)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_min)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_max)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_min)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_max)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_min)
- # time.sleep(0.75)
- # pwm.set_pwm(beastM_Right, 0, 0)
- #shift from 2st and 3nd
- # Move scene to scene 2 and beast to beast show
- pwm.set_pwm(gboxMotor, 0, 345) # TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- pwm.set_pwm(screen_Left, 0, 1200)
- time.sleep(12)
- pwm.set_pwm(screen_Left, 0, 0)
- checkifComplete(myChannel1) # Check if Audio1 complete
- myAudio10.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file10)
- myChannel1.play(myAudio10)
- checkifComplete(myChannel1) # Check if Audio1 complete
- # while GPIO.input(screenStop):
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMin)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 500)
- #
- # while GPIO.input(beastShow):
- # pwm.set_pwm(beastArm, 0, servo_min)
- # pwm.set_pwm(beastLeg, 0, servo_min)
- # time.sleep(0.75)
- # pwm.set_pwm(beastArm, 0, servo_max)
- # pwm.set_pwm(beastLeg, 0, servo_max)
- # time.sleep(0.75)
- # pwm.set_pwm(beastM_Left, 0, 500)
- #
- # # Insert Door sound
- #
- # # Move from scene 2 to scene home
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMax)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 0)
- # pwm.set_pwm(led_white, 0, 1024)
- # time.sleep(3)
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMin)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 500)
- # time.sleep(1)
- #
- # while GPIO.input(screenStop):
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMin)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 500)
- #
- # time.sleep(2)
- #
- # while GPIO.input(belleShow):
- # pwm.set_pwm(belleM_Right, 0, 1024)
- #
- # # Insert baby I am home
- myAudio11.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file11)
- myChannel1.play(myAudio11)
- checkifComplete(myChannel1) # Check if Audio1 complete
- #
- # # Insert beauty asking him what does he have and is it for her.
- myAudio12.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file12)
- myChannel1.play(myAudio12)
- checkifComplete(myChannel1) # Check if Audio1 complete
- #
- pwm.set_pwm(led_white, 0, led_high)
- pwm.set_pwm(belleM_Right, 0, 1024)
- time.sleep(7)
- pwm.set_pwm(belleM_Right, 0, 0)
- # # Beast says that it is her fav milkshake
- myAudio13.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file13)
- myChannel1.play(myAudio13)
- checkifComplete(myChannel1) # Check if Audio1 complete
- #
- # # Let us complete our game in the play room
- myAudio14.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file14)
- myChannel1.play(myAudio14)
- checkifComplete(myChannel1) # Check if
- #
- # # Beast says yes of course
- myAudio15.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file15)
- myChannel1.play(myAudio15)
- checkifComplete(myChannel1) # Check if
- #
- pwm.set_pwm(led_white, 0, 0)
- time.sleep(0.5)
- pwm.set_pwm(gboxMotor, 0, 345) # TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- pwm.set_pwm(screen_Left, 0, 1200)
- time.sleep(9)
- pwm.set_pwm(screen_Left, 0, 0)
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMax)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 0)
- # pwm.set_pwm(led_white, 0, 1024)
- # time.sleep(3)
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMin)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 500)
- # time.sleep(1)
- #
- # while GPIO.input(screenStop):
- # pwm.set_pwm(gboxMotor, 0, gearBox_servoMin)
- # time.sleep(0.25)
- # pwm.set_pwm(screen_Left, 0, 500)
- #
- # # Beauty says give it to me
- myAudio16.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file16)
- myChannel1.play(myAudio16)
- checkifComplete(myChannel1)
- #
- # # Beast says that I am going to put into something lol
- #
- myAudio17.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file17)
- myChannel1.play(myAudio17)
- checkifComplete(myChannel1)
- # # Beauty says great move.
- #
- myAudio18.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file18)
- myChannel1.play(myAudio18)
- checkifComplete(myChannel1)
- # # Narrator speaks 3rd scene lol
- #
- myAudio19.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file19)
- myChannel1.play(myAudio19)
- checkifComplete(myChannel1)
- pwm.set_pwm(led_white, 0, led_high)
- # # Beast says checkmate.
- myAudio20.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file20)
- myChannel1.play(myAudio20)
- checkifComplete(myChannel1)
- #
- # # Beauty says that she is tired and is going to try the milkshake.
- #
- myAudio21.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file21)
- myChannel1.play(myAudio21)
- checkifComplete(myChannel1)
- # # Beauty drinks the milkshake
- myAudio22.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file22)
- myChannel1.play(myAudio22)
- checkifComplete(myChannel1)
- #
- # # She does not feel so good
- myAudio23.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file23)
- myChannel1.play(myAudio23)
- checkifComplete(myChannel1)
- pwm.set_pwm(belleBody, 0, 600)
- time.sleep(0.5)
- #
- # # Ambulance sound.
- #
- myAudio24.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file24)
- myChannel1.play(myAudio24)
- #
- pwm.set_pwm(led_white, 0, led_low)
- pwm.set_pwm(gboxMotor, 0, 345) # TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- pwm.set_pwm(screen_Left, 0, 1200)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(led_red, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 3072)
- time.sleep(0.5)
- pwm.set_pwm(screen_Left, 0, 0)
- checkifComplete(myChannel1)
- # # Heavy breathing
- #
- myAudio25.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file25)
- myChannel1.play(myAudio25)
- checkifComplete(myChannel1)
- #
- # # Doc says that belle kena food poisoning.
- myAudio26.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file26)
- myChannel1.play(myAudio26)
- checkifComplete(myChannel1)
- #
- myAudio33.set_volume(1) # Reduce volume of first audio to 80%
- print("Playing audio : ", music_file33)
- myChannel1.play(myAudio33)
- checkifComplete(myChannel1)
- pwm.set_pwm(led_white, 0, 0)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(led_blue, 0, 0)
- pwm.set_pwm(gboxMotor, 0, 405) # TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- pwm.set_pwm(beastM_Right, 0, 1024)
- time.sheet(6)
- pwm.set_pwm(belleM_Left, 0, 1024)
- time.sheet(7)
- ppwm.set_pwm(gboxNMotor, 0, 345) # TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- pwm.set_pwm(screen_Right, 0, 1200)
- time.sleep(40)
- pwm.set_pwm(screen_right, 0, 0)
- ppwm.set_pwm(gboxNMotor, 0, 405) # TODO: 345 is engage, 405 disengage
- time.sleep(0.25)
- except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
- pwm.set_pwm(beastArm, 0, servo_max)
- pwm.set_pwm(beastM_Left, 0, 0)
- pwm.set_pwm(beastArm, 0, servo_min)
- pwm.set_pwm(led_white, 0, 0)
- pwm.set_pwm(led_red, 0, 0)
- pwm.set_pwm(beastM_Right, 0, 0)
- pwm.set_pwm(beastM_Left, 0, 0)
- pwm.set_pwm(gboxMotor, 0, 405)
- pwm.set_pwm(screen_Left, 0, 0)
- pwm.set_pwm(gboxMotor, 0, 405)
- GPIO.cleanup() # cleanup all GPIO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement