Question about using xBee module 'reset' XBee pin5. Gadgeteer XBee module connector socket pin 3

As I am not the brightest bulb on the holiday tree…

I could not find a way to set/reset the Gadgeteer XBee module ‘reset’ pin from the program generated code
xBeeSocket4 = new GTM.GHIElectronics.XBee(extenderSocket4.ExtenderSocketNumber);

So I put a extender module between the Fez Spider and the XBee module.

extenderSocket4 = new GTM.GHIElectronics.Extender(4);

//Used to reset the XBee device. Socket 4 pin 3 brings XBee RESET pin low for a moment.
//Socket 4 pin 3 connects to XBee device reset pin 5
XBeeReset = extenderSocket4.SetupDigitalOutput(GT.Socket.Pin.Three, true); // true sets pin 3 to 3.3 volts (high)


This works but is there a way to directly use the Gadgeteer XBee module (from xBeeSocket4) without adding the extender module?

Thanks for any hints…

Have a great day!

Sorry. I see no way to edit my original post?

Improper wording in
This works but is there a way to directly use the Gadgeteer XBee module (from xBeeSocket4) without adding the extender module?

Ignore (from xBeeSocket4)

Without the extender the program generated code would be… xBee = new GTM.GHIElectronics.XBee(4);
In other words, when using xBee reference I can find nothing (or don’t know how to use?) xBee reference to set/reset the module Socket 4 pin 3.


on your “edit” question. See that whited-out pencil? Hover over it and it then looks “enabled”. Click it and hey presto

Brett … Thanks! Like I said I am not the brightest bulb on the holiday tree…
But I’m old so I have an excuse…

Try this

var socket = Socket.GetSocket(4, true, xBee, null);
var pin = socket.CpuPins[3];
var xBeeReset = new OutputPort(pin, true);

Assuming that you connected XBee to socket 4.

Thank you for the reply…

I used code similar to what you posted and other variations like it…

I always get…
An unhandled exception of type ‘Gadgeteer.Socket.PinConflictException’ occurred in Gadgeteer.dll
Additional information:
Unable to configure the XBee module using socket 4 (pin 4).
There is a conflict with the module using socket 4 (pin 4).
Please try using a different combination of sockets.


However… Placing an extender module in the Program.gadgeteer.diagram, creating code for it, and then removing the extender module worked when connecting the xBee directly to the spider socket 4.

Show us your gadgeteer designer canvas. That usually means you have some other gadgeteer device connected on that port. When you “go around” the gadgeteer designer like the xbee port definition above, you need to move or remove the other device.

remove the Modules from your Designer…

most likely you have a Module added to the designer to that same socket…


Gif attached of canvass.

extenderSocket8 is connected to a WiFly device. socket 8 has a serial port defined using pins 4 and 5 for Tx/Rx and . Pin 3 and 6 are digital outputs connected to the WiFly.
Note that extenderSocket8 is NOT a real extender module. It is a ribbon cable connection to a GHI prototype pc board.

Everything works OK with and without the extenderSocket4 in place.

// GT.Interfaces.DigitalOutput WiFlyReset;
// GT.Interfaces.DigitalOutput WiFlyADhoc;
// GT.Interfaces.DigitalOutput XBeeReset;

// Gadgeteer.Modules.GHIElectronics.Extender extenderSocket8;
// Gadgeteer.Modules.GHIElectronics.XBee xBeeSocket4;
// Gadgeteer.Modules.GHIElectronics.Extender extenderSocket4;
// extenderSocket4 = new GTM.GHIElectronics.Extender(4);
// xBeeSocket4 = new GTM.GHIElectronics.XBee(extenderSocket4.ExtenderSocketNumber);
// extenderSocket8 = new GTM.GHIElectronics.Extender(8);

// WiFlyReset = extenderSocket8.SetupDigitalOutput(GT.Socket.Pin.Three, true);
// WiFlyADhoc = extenderSocket8.SetupDigitalOutput(GT.Socket.Pin.Six, false);

// Serial2 is used for programming the WiFly. Commands sent from a windows form.
// Using Socket 8 to GHI prototype board. serial2 to WiFly serial pins.
// Pin 1 3.3VDC, Pin 2 5VDC, Pin 3 GPIO (Interrupt), Pin 4 TX, Pin 5 RX, Pin 6 GPIO, Pin 7,8,9 NC, Pin 10 GND

     //   serial2 = new GT.Interfaces.Serial(GT.Socket.GetSocket(8, false, null, null),
     //           9600, // Using default for device. I have no need for high speed.
     //           GT.Interfaces.Serial.SerialParity.None,
     //           GT.Interfaces.Serial.SerialStopBits.One,
     //           8,
     //           GT.Interfaces.Serial.HardwareFlowControl.NotRequired, null);

Code I used based on your sample.

// var socket = GT.Socket.GetSocket(4, true, xBeeSocket4, null);
// var pin = GT.Socket.Pin.Four;
// var XBeeReset = new GT.Interfaces.DigitalOutput(socket, pin, true, xBeeSocket4); // OutputPort(pin, true);


I receive the exception even if the WiFly module is removed from the spider socket 8.

Using code tags will make your post more readable. This can be done in two ways:[ol]
Click the “101010” icon and paste your code between the

 tags or...
Select the code within your post and click the "101010" icon.[/ol]
(Generated by QuickReply)

Code tag… I was looking yesterday on how to use but I did not find anything…

You are not the first one to gripe at me about this!

Thanks for the info!

The problem is SOCKET 4 is already reserved because you have the Extender on it.

In the Program.Generated.CS you will find code like this:

       private void InitializeModules()
			// Initialize GTM.Modules and event handlers here.		
			extender = new GTM.GHIElectronics.Extender(4);
			xBee = new GTM.GHIElectronics.XBee(extender.ExtenderSocketNumber);

Please remove the XBEE and EXTENDER from the design surface, you’ll need to use the non-gadgeteer approach.

@ willgeorge - just surround your code in your post with [ code ] and [ /code ]

Thank you to all that replied to my question.

Everything is working as I intended using my current code. I am using the extender and xBee code as generated in Program.generated.cs and then removing the extender module and connecting the xBee directly to the Fez.Spider socket 4.

I just thought I should be able to use the xBeeSocket4 = new GTM.GHIElectronics.XBee(extenderSocket4.ExtenderSocketNumber); to access the reset pin and I was overlooking something…

Thanks again…

The Gadgeteer paradigm is such that when you allocate something on the design surface, it reserves the entire socket. If you want pin-level control you need to not let the Gadgeteer designer have control of that socket. So you can choose what you want to do - have reset capability or have to do more to bring the building blocks into your app - but it should all be achievable.

The good news is that the exception you were given says what the problem was.

@ willgeorge - remember that the xbee library you are using is just a prototype that exposes the serial line. The final version will expose a lot more, e.g. a method allowing to reset the module, so you don’t have to worry about the pin number.