IO Button

Hi guys this is a typical noobie question,

I want to use an external button besides the LDR button to control things. How do I go about assigning one of the IO ports as my button. I have been trying to use the schematics and such, but so far I can only get the LDR to not give me an error. Like shown below:

InterruptPort IntButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Digital.LDR, false,

Thanks for the help!

You will need to use the Pin name where you button is connected in place of the first parameter:


You also will need to subscribe to the interrupt event so you can execute your button press code.

See section 6.2 in book:

Welcome to the forum!

Ok cool but.

Say I want to use Digital IO D26. I have tried replacing LDR with IO26 and such, but no luck. How do I find the pin name corresponding to the shields pin name?

Thanks for the welcome!


What board are you using?

Panda II … Sorry about that

Ok I see. You have selected one of the pins that is not actually interrupt capable.

See the pinout from section FEZ Panda Pins Features in the user manual

Pins that have asterisk in the name (D30* for example) are the ones that Interrupt capable.

So try:


and connect your button to pin labeled D30 on the board.


Take a note that I am using Fez_Pin.Interrupt enumeration. That way I can see only interrupt capable pins.

Sweet! So all I needed was an " i " Haha!

Thanks a lot for the help Architect!

You are welcome!