Main Site Documentation

Add button module to extender board on Spider socket 8


#1

Can I add button module to extender board on Spider socket 8 if I’m already using the UART pins on the extender for serial communications?
I ran out of sockets but still need a button/switch.


#2

I don’t see why not. But you will most likely need to make your own module driver (easy to do). That will use same socket for both.


#3

You could use the button module connected directly to the extender board, and the extender board connected to the mainboard. Then wire up the UART TX/RX/Ground pins from the extender board to whatever you are connecting them to.

In order to use the button, use the Gadgeteer.Interfaces.InterruptInput, on Pin 3.

In order to use the UART on the same socket, use the Gadgeteer.Interfaces.Serial class.

When creating both interfaces, use the same socket that you have the extender module plugged into. More details of how to use Gadgeteer.Interfaces directly from your application can be found at the link below.

The button has an LED connected to Pin 4, which is the same as the transmit (TX) line of the UART. I think this means that whenever you transmit, the LED on the button is going to flash.

In general, you can have multiple modules / interfaces using the same socket. You will only get an exception if you try to use the same pin for two things at the same time. The Gadgeteer libraries check this internally, and will throw a PinConflictException to warn you about it.

I haven’t actually tested this, please let us know if you have any issues (or if you do get it to work).


#4

Thank you. I’ll try and report back.