Main Site Documentation

Input and Output


i want to use my us sensor with an panda fez 2.
But i don’t know how to convert a Output to an Input.
Us sensor :
My code :

public long US()
            long duree, distance;
            OutputPort USport = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di52, false);
            USport = null;
            InputPort USport = new InputPort((Cpu.Pin)FEZ_Pin.Digital.Di52, false, Port.ResistorMode.Disabled); //don't work }

but the end of my code don’t work, help me please.


you should just look at the code on the codeshare.


thanks, but i have a new question :slight_smile:

i can use tristateport with an digital pin ?

can i write ? :

            private TristatePort FEZ_Pin.Digital.Di52; 
            public Ping(Cpu.Pin pin) {

            TristatePort _pin = new TristatePort(pin, false, false, Port.ResistorMode.Disabled);


or i have to write :

 private TristatePort Di52; 



You give pin number to the TristatePort constructor. TristatePort variable you can name any way you want.