Sample code for serial communication using the extender module

I am planning on communicating with a device using serial on pin 4 of the spider. I assume i will be needing my extender module to break out the pins.
Does anyone has a sample code for serial communication using the extender module?

Something like this?

using Gadgeteer.Interfaces;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerApp2
{
    public partial class Program
    {
        void ProgramStarted()
        {
            GT.Interfaces.Serial serialPort = new Serial(GT.Socket.GetSocket(4, true, null, string.Empty), 9600, GT.Interfaces.Serial.SerialParity.None,GT.Interfaces.Serial.SerialStopBits.None,8,GT.Interfaces.Serial.HardwareFlowControl.NotRequired,null);
            serialPort.DataReceived += new Serial.DataReceivedEventHandler(serialPort_DataReceived);
        }
        void serialPort_DataReceived(Serial sender, System.IO.Ports.SerialData data)
        {
           //do stuff here
        }
    }
}

PS - i haven’t tested this at all :slight_smile:

2 Likes

Also have a squizz here: http://wiki.tinyclr.com/index.php?title=Device_to_PC_Communication

PS - for the Northern folk “squizz” means “Look” :wink:

2 Likes

Interesting alternate definitions here. Not sure what part of the world they use defintion #2… warning: x-rated.

@ ransomhall - indeed #2 is a tad colourful (note the spleding of colour :wink: )

Thank you all for the replies. I will try the code and let you know :slight_smile:

spleding = spelling? or is it more down under lingo?

@ ransomhall - no its not down under lingo just me being stupid as usual :slight_smile: