Monostable Multivibrator - Multivibrator in Mode 1

from __future__ import print_function
from BinPy.tools.clock import Clock
from BinPy.Gates import Connector
from BinPy.tools.multivibrator import Multivibrator
from BinPy.tools.oscilloscope import Oscilloscope
import time
# MODE selects the mode of operation of the multivibrator.

# Mode No. :  Description
#   1          Monostable
#   2          Astable
#   3          Bistable

out = Connector()
# Initialize mutivibrator in MODE 1

m = Multivibrator(0, mode=1, time_period=1)
m.start()
m.setOutput(out)
# Initialize the oscilloscope
o = Oscilloscope((out, 'OUT'))
o.start()
o.setScale(0.05)  # Set scale by trial and error.
o.setWidth(75)
o.unhold()
time.sleep(0.1)
m.trigger()  # Also works with m()
time.sleep(0.1)


# Display the oscilloscope
o.display()
==========================================================================================
BinPy - Oscilloscope
==========================================================================================
                                                      SCALE - X-AXIS : 1 UNIT WIDTH = 0.05
==========================================================================================
          │
          │
          │  ┌────────┐
     OUT  │  │        │
          ─ ─┘        └────────────────────────────────────────────────────────────────
          │
          │
││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││
──────────────────────────────────────────────────────────────────────────────────────────

# Kill the multivibrator and the oscilloscope threads
m.kill()
o.kill()