Ads
Tuesday, 31 March 2015
PL 4 Group A Codes
https://drive.google.com/file/d/0BxZLLe3YK34xdXk4aWxoS1NnVms/view?usp=sharing
If any one has A5 code and output please put it in the comments :D
If any one has A5 code and output please put it in the comments :D
Monday, 30 March 2015
PL4 B8 Leaky Buket
#include<iostream>
//#include<dos>
#include<stdlib.h>
#define bucketSize 512
using namespace std;
void bktInput(int psize,int r) {
if(psize>bucketSize)
cout<<"\nBucket overflow"<<endl;
else {
sleep(5);
while(psize>r)
{
cout<<"\n"<<r <<"bytes sent.";
psize-=r;
sleep(5);
}
if(psize>0)
cout<<"\nRemaining "<<psize<<" bytes sent";
cout<<"\nBucket output successful"<<endl;
}
}
int main() {
int rate, pktSize;
cout<<"\t\tBUCKET SIZE = 512 bytes"<<endl;
cout<<"Enter output rate: ";
cin>>rate;
for(int i=1;i<=5;i++)
{
sleep(5);
pktSize=rand() % 600+1;
cout<<"\nPacket no "<<i<<"\tPacket size "<<pktSize;
bktInput(pktSize,rate);
}
return 0;
}
Credits : Saurabh Pakhare
//#include<dos>
#include<stdlib.h>
#define bucketSize 512
using namespace std;
void bktInput(int psize,int r) {
if(psize>bucketSize)
cout<<"\nBucket overflow"<<endl;
else {
sleep(5);
while(psize>r)
{
cout<<"\n"<<r <<"bytes sent.";
psize-=r;
sleep(5);
}
if(psize>0)
cout<<"\nRemaining "<<psize<<" bytes sent";
cout<<"\nBucket output successful"<<endl;
}
}
int main() {
int rate, pktSize;
cout<<"\t\tBUCKET SIZE = 512 bytes"<<endl;
cout<<"Enter output rate: ";
cin>>rate;
for(int i=1;i<=5;i++)
{
sleep(5);
pktSize=rand() % 600+1;
cout<<"\nPacket no "<<i<<"\tPacket size "<<pktSize;
bktInput(pktSize,rate);
}
return 0;
}
Credits : Saurabh Pakhare
Sunday, 29 March 2015
PL3 BBB Lift Generic Code
import Adafruit_BBIO.GPIO as G
import time
l1 = "P8_12"
l2 = "P8_18"
l3 = "P8_16"
b1 = "P8_11"
b2 = "P8_13"
b3 = "P8_26"
G.setup(l1,G.OUT)
G.setup(l2,G.OUT)
G.setup(l3,G.OUT)
G.setup(b1,G.IN)
G.setup(b2,G.IN)
G.setup(b3,G.IN)
def glow(cur):
if(cur==1):
G.output(l1,G.HIGH)
G.output(l2,G.LOW)
G.output(l3,G.LOW)
elif(cur==2):
G.output(l2,G.HIGH)
G.output(l1,G.LOW)
G.output(l3,G.LOW)
elif(cur==3):
G.output(l3,G.HIGH)
G.output(l2,G.LOW)
G.output(l1,G.LOW)
time.sleep(2)
def chf(cur, next):
while(cur!=next):
if(cur>next):
cur=cur-1
else:
cur=cur+1
glow(cur)
cur=1
next=1
while True:
if(G.input(b1)==1):
next=1
chf(cur,next)
cur=next
elif(G.input(b2)==1):
next=2
chf(cur,next)
cur=next
elif(G.input(b3)==1):
next=3
chf(cur,next)
cur=next
import time
l1 = "P8_12"
l2 = "P8_18"
l3 = "P8_16"
b1 = "P8_11"
b2 = "P8_13"
b3 = "P8_26"
G.setup(l1,G.OUT)
G.setup(l2,G.OUT)
G.setup(l3,G.OUT)
G.setup(b1,G.IN)
G.setup(b2,G.IN)
G.setup(b3,G.IN)
def glow(cur):
if(cur==1):
G.output(l1,G.HIGH)
G.output(l2,G.LOW)
G.output(l3,G.LOW)
elif(cur==2):
G.output(l2,G.HIGH)
G.output(l1,G.LOW)
G.output(l3,G.LOW)
elif(cur==3):
G.output(l3,G.HIGH)
G.output(l2,G.LOW)
G.output(l1,G.LOW)
time.sleep(2)
def chf(cur, next):
while(cur!=next):
if(cur>next):
cur=cur-1
else:
cur=cur+1
glow(cur)
cur=1
next=1
while True:
if(G.input(b1)==1):
next=1
chf(cur,next)
cur=next
elif(G.input(b2)==1):
next=2
chf(cur,next)
cur=next
elif(G.input(b3)==1):
next=3
chf(cur,next)
cur=next
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"
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"
Saturday, 28 March 2015
Friday, 27 March 2015
Thursday, 26 March 2015
Monday, 16 March 2015
PL3 Group A Write UPS
LIFT
https://drive.google.com/folderview?id=0BxZLLe3YK34xfjNUU0VYUU5sajZNMURZNkNNb2RBSjRkMUlmcnlYUFNhRlRKSE9zejF0a28&usp=sharing
SIGNAL
https://drive.google.com/folderview?id=0BxZLLe3YK34xfjZQRGx2M1doUi1aUzdsYmNGdzM4SjhVZHBYOEZwakpCSmRja3doVXdjLTQ&usp=sharing
LISP
https://drive.google.com/folderview?id=0BxZLLe3YK34xfmkxLUxYUDNialB6d1NwcjBuT1pWc3FQYkQ2cTZLN0tVc1cwbGUyWDdNaFU&usp=sharing
LEX n YACC
https://drive.google.com/folderview?id=0BxZLLe3YK34xfnRwNEV1bkpKUW84aXdOYXJVTUlkQU5oNnlreTNacFlVUXd0bGo4c1VyZUk&usp=sharing
https://drive.google.com/folderview?id=0BxZLLe3YK34xfjNUU0VYUU5sajZNMURZNkNNb2RBSjRkMUlmcnlYUFNhRlRKSE9zejF0a28&usp=sharing
SIGNAL
https://drive.google.com/folderview?id=0BxZLLe3YK34xfjZQRGx2M1doUi1aUzdsYmNGdzM4SjhVZHBYOEZwakpCSmRja3doVXdjLTQ&usp=sharing
LISP
https://drive.google.com/folderview?id=0BxZLLe3YK34xfmkxLUxYUDNialB6d1NwcjBuT1pWc3FQYkQ2cTZLN0tVc1cwbGUyWDdNaFU&usp=sharing
LEX n YACC
https://drive.google.com/folderview?id=0BxZLLe3YK34xfnRwNEV1bkpKUW84aXdOYXJVTUlkQU5oNnlreTNacFlVUXd0bGo4c1VyZUk&usp=sharing
Sunday, 8 March 2015
PL4 Writeups A(1-6)
Assignments
a1 https://drive.google.com/file/d/0BxZLLe3YK34xZk9Ib3hWaGN0MkU/view?usp=sharing
a2 https://drive.google.com/file/d/0BxZLLe3YK34xWXNRbllGMUlKblk/view?usp=sharing
a3 https://drive.google.com/file/d/0BxZLLe3YK34xZ3hzT3hBQkEtcmc/view?usp=sharing
a4 https://drive.google.com/file/d/0BxZLLe3YK34xb3EyTS1DUmJkSUE/view?usp=sharing
a5 https://drive.google.com/file/d/0BxZLLe3YK34xMVd2THIwUF9XRUk/view?usp=sharing
a6 https://drive.google.com/file/d/0BxZLLe3YK34xRkVPRlZVZXdwNm8/view?usp=sharing
Credits :-Tushar Badgu
a1 https://drive.google.com/file/d/0BxZLLe3YK34xZk9Ib3hWaGN0MkU/view?usp=sharing
a2 https://drive.google.com/file/d/0BxZLLe3YK34xWXNRbllGMUlKblk/view?usp=sharing
a3 https://drive.google.com/file/d/0BxZLLe3YK34xZ3hzT3hBQkEtcmc/view?usp=sharing
a4 https://drive.google.com/file/d/0BxZLLe3YK34xb3EyTS1DUmJkSUE/view?usp=sharing
a5 https://drive.google.com/file/d/0BxZLLe3YK34xMVd2THIwUF9XRUk/view?usp=sharing
a6 https://drive.google.com/file/d/0BxZLLe3YK34xRkVPRlZVZXdwNm8/view?usp=sharing
Credits :-Tushar Badgu
Subscribe to:
Posts (Atom)