FEZCerbuinoBee XBee Socket?


I’m using the FEZCerbuionBee.
I found these two libraries:



Both ask for a socket to initialize it. I have an xBee plugged into this the CerbuinoBee but how do I initialize and use it? (I’ve tried a bit of the sample code to no avail…)

~Shane :frowning:

The class there is designed to work with the actual module [url]https://www.ghielectronics.com/catalog/product/314[/url]

If you want to talk to the device plugged into the Xbee socket on the main board, you can use COM1

SerialPort port = new SerialPort(“COM1”, 9600, Parity.None, 8, StopBits.One);

What device do you have plugged in?

I have the xBee plugged into the board it self, not the module. I cannot get the ‘SerialPort’ class to enumerate. Which .dll needs to be references for VS2012 professional to read the serial port? I am using the mini-USB port on the FEZCerbuinoBee and plugging that into My PC.

what I’m asking is to fill in the ‘something’.

something.something.something.SerialPort port = new something.something.something.SerialPort(“COM1”, 9600, Parity.None, 8, StopBits.One);

Here is what doesn’t work (and I don’t know why either):


Thanks for your help!

@ shanekirkbride - If you include those references, you should be able to declare a SerialPort, right click on SerialPort and resolve it’s using reference.

1 Like

@ shanekirkbride

Here is a simple console program that will echo the data input from the other device that is connected:

using System;
using System.IO.Ports;
using System.Text;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace CerbuinoNetCOM_Echo
    public class Program
        public static void Main()
            SerialPort UART = new SerialPort("COM1", 9600);
            byte[] openingStatement = Encoding.UTF8.GetBytes("\n\rI am open from COM 1\n\r");

            int read_count = 0;
            byte[] rx_byte = new byte[1];


            UART.Write(openingStatement, 0, openingStatement.Length);

            while (true)

                // read one byte
                read_count = UART.Read(rx_byte, 0, 1);
                if (read_count > 0)// do we have data?
                    // create a string
                    string counter_string =
                            "I am being Transmitted from the Cerbuino Net over COM 1 \n\n\rYou typed: " + (char)rx_byte[0] + "\r\n";
                    // convert the string to bytes
                    byte[] buffer = Encoding.UTF8.GetBytes(counter_string);
                    // send the bytes on the serial port
                    UART.Write(buffer, 0, buffer.Length);


The references in this example are:

Also make sure you are referencing framework 4.2 and not 4.3

1 Like

Thanks for your help and your quick reply. This solution seems to work. I’ll need to try it on the actual hardware and I don’t have that with me right now. Just for completeness here are some more details

In the first image from the instruction site I’ve NOT installed the .NETMF Framework 4.2 because I do not have VS2010

However I did install the GHI package and the capability to reference 4.2 is there. When I initially start a ‘new’ project I use the ‘Gageteer’ selection and choose FEZCebrinoBee. Upon loading the code compiles just fine. There is a snapshot of all the auto-references in the selections.

I complied this successfully on VS-2012 ultimate. Thanks for your help

@ shane,

when you open the port you should discard the in and out buffers


Also you need to set “StartUp Object” in the project properties for the code to “Run”

Depending on the module you will need to specific the Serial Port properties
the data bits (8) and stop bits (StopBits.One)

new SerialPort(“COM1”, 9600, Parity.None, 8, StopBits.One)

In the first sentence there you say you do NOT have VS2012. But you go on to say you do. I’m not sure I understand - not that it’s overly relevant since you got it working. But let me explain. The netmf SDK that you need includes the ability to target multiple netmf versions. The important piece is that the SDK itself is meant to target a particular VS version. So if you have VS2012, you need the netmf 4.3 SDK, but if you only have VS2012 you need netmf 4.2 (RTM QFE2) SDK. With the 4.3 SDK you can target netmf 4.3, 4.2, 4.1 as well as others… With VS2010 and 4.2 SDK, you can target 4.2, 4.1 etc.

hi Brett,
This was a typo, I meant I don’t have VS-2010 (I fixed my comment in the post).
Thanks for the clarification on how the SDKs work! There are A LOT of different libraries and since I just started i’m trying to sort it all out in my head.