Pin di input e output

Si in teoria quello che hai scritto dovrebbe funzionare