import time # MODE selects the mode of operation of the multivibrator. # Mode No. : Description # 1 Monostable # 2 Astable # 3 Bistable out = Connector() # MODE 2 m = Multivibrator(0, 2, on_time=0.2, off_time=0.8) m.start() m.setOutput(out) m.trigger() o = Oscilloscope((out, 'OUT')) o.start() o.setScale(0.2) o.unhold() time.sleep(10) o.display() m.kill()
out = Connector(0) # MODE 3 m = Multivibrator(0, mode=3) m.start() m.setOutput(out) o = Oscilloscope((m.A, 'OUT')) o.start() o.setScale(0.05) o.unhold() time.sleep(0.1) m.trigger() print(m.A()) time.sleep(0.5) m.trigger() print(m.A()) time.sleep(1) m.trigger() print(m.A()) time.sleep(2) m.trigger() print(m.A()) o.display() o.kill() m.kill()
m = Multivibrator(0, mode=1, time_period=1) m.start() m.setOutput(out) # In[4]: # Initialize the oscilloscope o = Oscilloscope((out, 'OUT')) o.start() o.set_scale(0.005) # Set scale by trial and error. o.set_width(100) o.unhold() time.sleep(0.1) m.trigger() # Also works with m() time.sleep(0.1) # In[5]: # Display the oscilloscope o.display() # In[6]: # Kill the multivibrator and the oscilloscope threads m.kill() o.kill()