Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.


Member Since 03 Apr 2012
Offline Last Active Jun 25 2012 02:09 PM

Topics I've Started

Serial Port Problems

29 May 2012 - 08:31 PM

I am trying to get my head around serial ports using VB and having problems here. I am interfacing with SeeedStudio GSM board.

Here is my code....

Dim awatingResponseString As String = ""
Dim awaitingResponse As Boolean = False
Dim sp As SerialPort

Public Sub Main()
        Dim sp As New SerialPort(SerialPorts.COM1, 19200, Parity.Odd, 8, StopBits.One)
        SendSMS("18005551212", "test")
    End Sub

Public Sub PrintLine(ByVal line As String, Optional ByVal awaitResponse As Boolean = False, Optional ByVal awaitResponseString As String = "")
        If Not awaitResponseString.Equals("") Then
            awatingResponseString = awaitResponseString
            While Not awatingResponseString.Equals("")
            End While
        End If
        If awaitResponse Then
            awaitingResponse = True
            While awaitingResponse

            End While
        End If
    End Sub

    Private Sub Print(ByVal line As String)
        Dim encoder As New System.Text.UTF8Encoding()
        Dim bytesToSend As Byte() = encoder.GetBytes(line)
        sp.Write(bytesToSend, 0, bytesToSend.Length)
    End Sub

    Public Sub SendSMS(ByVal msisdn As String, ByVal message As String)
        PrintLine("AT+CMGF=1", True)
        PrintLine("AT+CMGS=""" & msisdn & """", False)
        'Debug.Print("SMS Sent!");
    End Sub

    Private Sub PrintEnd()
        Dim bytesToSend As Byte() = New Byte(0) {}
        bytesToSend(0) = 26
        sp.Write(bytesToSend, 0, 1)
    End Sub

In the Print() function I get this error:

An unhandled exception of type 'System.NullReferenceException' occurred in Netduino Power Control.exe

And I get this error when I issue the sp.write.
I am trying understand how to test and debug with serial port but keep bumping my head here.
Can anyone offer help?


Serial Terminal

20 May 2012 - 10:56 PM

In arduino we are able to interface a pc based terminal application to the serial ports on the board and thus talk to shields directly from the pc for debugging purposes. Would anyone have sample code to do the same in Netduino? Thanks

Netduino Plus and Seedstudio GPRS Shield

27 April 2012 - 09:38 PM

I am very new to the concept of netduino development and I must admit there are a few hurdles I need to cross. My background is in windows application development and my formal eduaction is in microprocessor and fw design with some emphasis in PLC implementation. I say all of this to say that I have some exposure to the idea of hardware development and am comfortable with the Visual Studio design environment.

I am however struggling with this device


I have located this helper wiki:

I have located a helper library here:

I have downloaded the helper library and have tried to post simple SMS messages with no real luck. It seems that when I insert my break points into simple code like this Visual Studio simply dies when I try to watch a variable or even mouse over an object.

'static int bufferLength = 0;
        Public Sub New(Optional ByVal portName As String = SerialPorts.COM1, Optional ByVal baudRate As Integer = 19200, Optional ByVal parity__1 As Parity = Parity.Odd, Optional ByVal dataBits As Integer = 8, Optional ByVal stopBits__2 As StopBits = StopBits.One)
            serialPort = New SerialPort(portName, baudRate, parity__1, dataBits, stopBits__2)
            serialPort.ReadTimeout = -1
            serialPort.WriteTimeout = 10
            serialPort.Handshake = Handshake.XOnXOff

            AddHandler serialPort.DataReceived, New SerialDataReceivedEventHandler(AddressOf serialPort_DataReceived)
        End Sub

My question is this... are there any good reference links to getting started with serial communication using the netduino Plus?

Secondly if anyone has experience developing with this shield and is interested in making some contract money I will pay for the work to be done - I have all the control logic built I am just struggling to get around the communication piece of this.

Thank you in advance for your consideration.

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.