Code for communication between FEZ Cerberus Mainboard and PC via USB and XBee Adapter

I want to transfer a simple integer from the FEZ Cerberus Mainboard to the PC via USB and via XBee Adapter and just need the code for it (C#).

BTW: Sorry my first entry here… just put it into the right category if I choose the wrong one.

Thanks a lot for helping me!

Welcome to the forum!

You can use one of the USB-To-Serial adapters that you can connect to you PC and Serial Port on Cerberus. After that it would be trivial to communicate via Virtual COM Port on PC and UART on Cerberus.

You can use this Gadgeteer module for that:

@ GermanDude - What XBee adapter? ZigBee, DigiMesh, or WiFi?

Do you want to operate in transparent or API mode?

Have you check for code in Community/CodeShare?

Sorry for not answering as fast as you guys…
Yeah i wanted to use an USB-Serial adapter and a Xbee-WiFi adapter.
I looked a bit in the codesharing topic but haven’t found anything…

@ Mike I don’t really know what you mean with “tranparent or API mode” (sorry I’m a really newbie :smiley: )

Thanks for helping me!

Hi, for WiFi you could use an Microchip RN-VX on the GHI XBee adapter Module or munderhills WiFi Module (not XBee). Perhaps this Codeshare entry can hep you getting started.

@ GermanDude - I have not used a XBee WiFi module yet. I don’t know if there is the equivalent of transparent and API modes. Get the user manual for the WiFi module, and it will tell you how to control it. I believe the interface if a UART (SerialPort).

Hello and welcome,

For usb-serial if it can help:

1 Like

Thank you guys! You all helped me a lot!

@ bauland could you explain me how you send the data to the pc (and maybe in an easier way ;D )
for example I just have a joystick… so maybe:


Thank you!

PS: quite hard to find informations about USBserial here :frowning:

First, don’t forget the code button (101010 button before bold button) !


To send data, if you have your usbSerial configured and opened:

usbSerial.WriteLine("any string");

The string you send dépends on you: it can be the state of the joystick or anything else …
The flush method is to insure that data are send now.

1 Like

Sorry what do you mean with the code button?
as config i have:

thanks anyway!

For the code button, I mean that in your previous message code is unformatted. You should edit your message and put code marker with the “code” button of forum.

For your code, you have configure your serial port.
Now, you can open it and send data:


1 Like

Thanks, finally my programm is running at least :slight_smile:
But how does the PC recieve the message?
Can’t even find it in debug window :confused:

You could:
[ul]use tera term pro to see message on pc side,[/ul][ul]create your own application to read message. [/ul]

1 Like

Oh okay :open_mouth:
Thanks for all of your help!

just for everyone else who maybe wants to know it… that’s what my program finally look like :wink:

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp1
    public partial class Program
        GT.Timer timer = new GT.Timer(1000);
        // This method is run when the mainboard is powered up or reset.   
        int i = 0;
        void ProgramStarted()
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            usbSerial.Configure(9600, GT.Interfaces.Serial.SerialParity.None, GT.Interfaces.Serial.SerialStopBits.One, 8);
            Mainboard.SetDebugLED(on: true);
            Mainboard.SetDebugLED(on: false);
            timer.Tick += timer_Tick;
        void timer_Tick(GT.Timer timer)
            if (joystick.IsPressed)
                Mainboard.SetDebugLED(on: true);
                usbSerial.SerialLine.Write("Button Pressed "+ i +" time(s) ");
                Mainboard.SetDebugLED(on: false);