Main Site Documentation

Basics of serial ports


#1

Hi guys,

I need your help. I’m not a natural programmer, so please be kind.
The lines below were made with visual 2010, MF 4.2 with SDK dated in oct 2013; to run on an Hydra.

public class serialport_manager
{
Gadgeteer.Socket Socket;

    public bool connect()
    {
        Socket = Gadgeteer.Socket.GetSocket(6, true, null, null);

Now, this code is not working.

“A first chance exception of type ‘Gadgeteer.Socket.InvalidSocketException’ occurred in Gadgeteer.dll”

The actual environment was downloaded yesterday from GHI support web.

What is wrong with it?


#2

Have you tried to use the Gadgeteer designer?


#3

Hey Myke, thanks for your support.

About Gadgeteer Designer, I’m having some issues with it (see attachment). That message appears when creating a new project.
Anyway, I just need to open this serial port, and the only way I found was directly with the name “COM4”.

SerialPort = new System.IO.Ports.SerialPort(“COM4”, 9600, Parity.None, 8, StopBits.One);


#4

Hi crespi

What are you expecting with : Socket = Gadgeteer.Socket.GetSocket(6, true, null, null);

Why not giving correct parameter to the getSocket method?


#5

Hi leforban

To be honest, I use the type Gadgeteer.Socket to get the socket.name. I just panicked a little bit when realized that previous stable code was not working.

Now the project is delayed by Hydra malfunction. PC just not recognize it as a device when is mounted. The other mainboards (Cerberus, spider, etc) are working fine. I’m worried about it, because Hydra is my best Gadgeteer tool.