Saturday, 28 January 2017

An assignment to develop an application using Beeglebone Black/ ARM Cortex A5 development board to simulate the operations of LIFT.


The Intefacing of BBB(Beagle Bone Black) with Switch and LED is as follows:




The following python program helps to simulate operations of LIFT using Beagle Bone Black:

import Adafruit_BBIO.GPIO as g
import time

g.setup("P8_26",g.OUT)       #yellow led i.e. second floor
g.output("P8_26",g.LOW)
g.setup("P8_10",g.OUT)       #red led i.e. first floor
g.output("P8_10",g.HIGH)
g.setup("P9_15",g.OUT)         #green led i.e third floor
g.output("P9_15",g.LOW)
g.setup("P8_14",g.IN)        #switch 1 i.e. button for first floor
g.setup("P8_18",g.IN)         #switch 2 i.e. button for second floor
g.setup("P9_17",g.IN)        #switch 3 i.e. button for third floor
print "The Lift is on First Floor"
current_floor=1

while True:
        if(current_floor==1):
            if(g.input("P8_18")==1):    
                print "The Lift is moving from First to Second Floor"
                g.output("P8_26",g.HIGH)
                time.sleep(1)
                g.output("P8_10",g.LOW)  
                current_floor=2
                continue
            if(g.input("P9_17")==1): 
                print "The Lift is moving from First to Second Floor"
                g.output("P8_26",g.HIGH)
                time.sleep(1)
                print "The Lift is moving from Second to Third Floor"
                g.output("P9_15",g.HIGH)
                time.sleep(1)
                g.output("P8_10",g.LOW)
                g.output("P8_26",g.LOW)
                current_floor=3
                continue

        if(current_floor==2):
            if(g.input("P8_14")==1):           
                print "The Lift is moving from Second to First Floor"
                g.output("P8_10",g.HIGH)
                time.sleep(1)
                g.output("P8_26",g.LOW)
                current_floor=1
                continue
            if(g.input("P9_17")==1):           
                print "The Lift is moving from Second to Third Floor"
                g.output("P9_15",g.HIGH)
                time.sleep(1)
                g.output("P8_26",g.LOW)
                current_floor=3
                continue

        if(current_floor==3):
            if(g.input("P8_14")==1):
                print "The Lift is moving from Third toSecond Floor"
                g.output("P8_26",g.HIGH)
                time.sleep(1)
                print "The Lift is moving from Second to First Floor"
                g.output("P8_10",g.HIGH)
                time.sleep(1)
                g.output("P9_15",g.LOW)
                g.output("P8_26",g.LOW)
                current_floor=1
                continue
            if(g.input("P8_18")==1):
                print "The Lift is moving from Third to Second Floor"
                g.output("P8_26",g.HIGH)
                time.sleep(1)
                g.output("P9_15",g.LOW)
                current_floor=2
                continue










No comments:

Post a Comment