Ads

Sunday 29 March 2015

PL3 BBB Lift Sequential

import Adafruit_BBIO.GPIO as GPIO

import time



GPIO.setup("P8_10",GPIO.IN)

GPIO.setup("P8_12",GPIO.OUT)

GPIO.setup("P8_14",GPIO.IN)

GPIO.setup("P8_18",GPIO.OUT)

GPIO.setup("P8_15",GPIO.IN)

GPIO.setup("P8_16",GPIO.OUT)

GPIO.output("P8_12",GPIO.HIGH)

CS="GL"

while True:

        GL=GPIO.input("P8_10")

        ML=GPIO.input("P8_14")

        HL=GPIO.input("P8_15")

        if GL==1:

                if CS=="ML":

                        GPIO.output("P8_18",GPIO.LOW)

                        time.sleep(2)

                        GPIO.output("P8_12",GPIO.HIGH)

                        CS="GL"

                if CS=="HL":

                        GPIO.output("P8_16",GPIO.LOW)

                        time.sleep(2)

                        GPIO.output("P8_18",GPIO.HIGH)

                        time.sleep(2)

                        GPIO.output("P8_18",GPIO.LOW)

                        GPIO.output("P8_12",GPIO.HIGH)

                        CS="GL"

                       



        elif ML==1:



                if CS=="GL":

                        GPIO.output("P8_12",GPIO.LOW)

                        time.sleep(2)

                        GPIO.output("P8_18",GPIO.HIGH)

                        CS="ML"

                if CS=="HL":

                        GPIO.output("P8_16",GPIO.LOW)

                        time.sleep(2)

                        GPIO.output("P8_18",GPIO.HIGH)

                        CS="ML"

     

        elif HL==1:

                if CS=="GL":

                        GPIO.output("P8_12",GPIO.LOW)

                        time.sleep(2)

                        GPIO.output("P8_18",GPIO.HIGH)

                        time.sleep(2)

                        GPIO.output("P8_18",GPIO.LOW)

                        GPIO.output("P8_16",GPIO.HIGH)

                        CS="HL"

                if CS=="ML":

                        GPIO.output("P8_18",GPIO.LOW)

                        time.sleep(2)

                        GPIO.output("P8_16",GPIO.HIGH)

                        CS="HL"

No comments:

Post a Comment