In [1]:
from BinPy import *
# Source Bus
a = Bus(4)
a.set_type(analog=True)
a.set_voltage_all(3.5, 6.7, 2.2, 1.1)
# Ouput Bus
b = Bus(4)
b.set_type(analog=True)
# Enable input
e = Bus(1)
e.set_logic_all(1)
In [2]:
# Initializing an analog Buffer
buff1 = AnalogBuffer(a, b, e, 0.8) # With an attenuation of 0.8, relay the input to the output
In [3]:
print b.get_voltage_all()
In [4]:
# BinPy automatically converts the voltage to logic state based on 5v-0v logic
print b.get_logic_all()
In [5]:
print b.get_voltage_all()
In [ ]:
# Changing the input
a.set_voltage_all(1,1,1,1)
In [7]:
b.get_voltage_all()
Out[7]:
In [8]:
# Changing the attenuation level
buff1.set_attenuation(0)
In [9]:
b.get_voltage_all()
Out[9]: