Ejemplo n.º 1
0
def test_bad_arguments():
    # Too many devices.
    with assert_raises(ValueError, "too many devices"):
        Dac([0, 1, 2])
        
    # Bad devices type.
    with assert_raises(TypeError, "bad devices"):
        Dac(None)
Ejemplo n.º 2
0
def test_output():
    # Single pin.
    dac = Dac(board.PIN_DAC0)
    dac.convert("\x03\xff")

    # List of pins.
    dac = Dac([board.PIN_DAC0, board.PIN_DAC1], 11025)
    dac.convert(bytearray(16 * "\x03\xff"))
    dac.convert(16 * "\x03\xff")
    dac.async_convert(16 * "\x03\xff")
    dac.async_wait()
Ejemplo n.º 3
0
 def __init__(self):
     self.state = STATE_STOPPED
     self.dac = Dac([Board.PIN_DAC0, Board.PIN_DAC1], 10000)
     self.event = Event()
     self.playlist = os.listdir()
     self.index = 0
     self.fsong = None
     self.timer = None
     self.identity = None
Ejemplo n.º 4
0
def test_print():
    print(Dac)
    dac = Dac(board.PIN_DAC0)
    print(dac)