Saturday, 28 January 2017

An Assignment to develop an application using Beeglebone Black/ ARM Cortex A5 development board to simulate the working of signal lights.

The Interfacing of BBB(Beagle Bone Black) with switch and led are shown in figure below. However in this assignment we have interfaced only LED's with BBB(Beagle Bone Black).


The following python code helps to simulate working of signal lights using Beagle Bone Black:

import time
import Adafruit_BBIO.GPIO as a

a.setup("P8_10", a.OUT)    #red LED
a.setup("P8_12", a.OUT)    #yellow LED
a.setup("P8_14", a.OUT)    #green LED

while True:
    a.output("P8_10", a.HIGH) 
    time.sleep(5)
    a.output("P8_10", a.LOW)  
    a.output("P8_12", a.HIGH)
    time.sleep(5)
    a.output("P8_12", a.LOW)
    a.output("P8_14", a.HIGH)
    time.sleep(5)
    a.output("P8_14", a.LOW)


At some Places all the Traffic Lights start blinking at night time after normal execution throughout the day. This situation can be simulated by the following Python code using Beagle Bone Black:


import time
import Adafruit_BBIO.GPIO as a

a.setup("P8_10", a.OUT) #red LED
a.setup("P8_12", a.OUT) #yellow LED
a.setup("P8_14", a.OUT) #green LED
count=10
count_1=4

while True:
    while count>0:
        a.output("P8_10", a.HIGH)
        time.sleep(2)
        a.output("P8_10", a.LOW)   
        a.output("P8_12", a.HIGH)
        time.sleep(2)
        a.output("P8_12", a.LOW)
        a.output("P8_14", a.HIGH)
        time.sleep(2)
        a.output("P8_14", a.LOW)
        count=count-1
    count=10

    while count_1>0:
        a.output("P8_10", a.HIGH)
        a.output("P8_12", a.HIGH)
        a.output("P8_14", a.HIGH)
        time.sleep(1)       
        a.output("P8_10", a.LOW)   
        a.output("P8_12", a.LOW)
        a.output("P8_14", a.LOW)
        time.sleep(2)
        count_1=count_1-1
    count_1=4


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