import pyfirmata


def DigitalInput(board,pin):
    DigitalInputPin=board.get_pin('d:'+ str(pin) +':i')
    return DigitalInputPin

def AnalogOutput(board,pin):
    AnalogOutputPin=board.get_pin('d:'+ str(pin) +':p')
    return AnalogOutputPin

def AnalogInput(board,pin):
    AnalogInputPin = board.get_pin('a:'+ str(pin) +':i')
    return AnalogInputPin

def DigitalWrite(board,pin,val):
    board.digital[pin].write(val)

def AnalogWrite(board,pin,val):
    board.digital[pin].write(val)

def Iterateur(board):
    it = pyfirmata.util.Iterator(board)
    it.start()
    return it
