- Netduino Forums
- → tknman0700's Content
tknman0700's Content
There have been 26 items by tknman0700 (Search limited from 26-April 23)
#30030 Serial Port Problems
Posted by tknman0700 on 31 May 2012 - 04:09 AM in Netduino Plus 2 (and Netduino Plus 1)
#30029 Netduino Plus 1 Firmware v4.1.0 (update 6)
Posted by tknman0700 on 31 May 2012 - 03:40 AM in Netduino Plus 2 (and Netduino Plus 1)
#30028 VS2010 Crash on debug
Posted by tknman0700 on 31 May 2012 - 03:37 AM in Visual Basic Support
#30022 Serial Port Problems
Posted by tknman0700 on 31 May 2012 - 02:04 AM in Netduino Plus 2 (and Netduino Plus 1)
Private Sub serialPort_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) ' Check if Chars are received Dim ReadBuffer As Byte() = New Byte(sp.BytesToRead - 1) {} If e.EventType = SerialData.Chars Then ' Create new buffer sp.Read(ReadBuffer, 0, ReadBuffer.Length) If ReadBuffer.Length > 0 And (ReadBuffer(ReadBuffer.Length - 1) = 10 OrElse ReadBuffer(ReadBuffer.Length - 1) = 0) Then ' New line or terminated string. output.Append(GetUTF8StringFrombytes(ReadBuffer)) Debug.Print("Recieved : " & output.ToString()) output.Clear() Else Try output.Append(GetUTF8StringFrombytes(ReadBuffer)) Catch ecx As Exception Debug.Print("Cannot parse : " & ecx.StackTrace) End Try End If End If End Sub
The problem is that when I "read" from the bus I also see what I just sent to the bus.
I have added the above as a handler....
AddHandler sp.DataReceived, New SerialDataReceivedEventHandler(AddressOf serialPort_DataReceived)
But I am not sure why I see the stuff I just sent to the serial bus in addition to the data that the device placed on the bus. Like i said I am new to hardware interfacing but not .net development. I think I am just missing a few connections here to really taking good advantage of this prototyping kit.
Any direction for handling serial data is appreciated...
This is code I have adapted from a few sources online as starters...
Thanks
#29999 Serial Port Problems
Posted by tknman0700 on 30 May 2012 - 04:27 PM in Netduino Plus 2 (and Netduino Plus 1)
#29957 Serial Port Problems
Posted by tknman0700 on 29 May 2012 - 09:37 PM in Netduino Plus 2 (and Netduino Plus 1)
#29956 Serial Port Problems
Posted by tknman0700 on 29 May 2012 - 09:08 PM in Netduino Plus 2 (and Netduino Plus 1)
#29952 Netduino Firmware v4.2.0 RC5 (Netduino + Netduino Plus)
Posted by tknman0700 on 29 May 2012 - 08:51 PM in Beta Firmware and Drivers
Before deploying the attached firmware, you should erase your board completely and flash the v4.2 RC5 bootloader (included in the attached ZIP file).
Can you tell me how I might go about that? It isnt in your details unless I am missing it.
#29951 Serial Port Problems
Posted by tknman0700 on 29 May 2012 - 08:48 PM in Netduino Plus 2 (and Netduino Plus 1)
#29949 Serial Port Problems
Posted by tknman0700 on 29 May 2012 - 08:31 PM in Netduino Plus 2 (and Netduino Plus 1)
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("") Thread.Sleep(1000) End While End If Print(line) If awaitResponse Then awaitingResponse = True While awaitingResponse Thread.Sleep(100) 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(""); PrintLine("AT+CMGF=1", True) PrintLine("AT+CMGS=""" & msisdn & """", False) PrintLine(message) Thread.Sleep(100) PrintEnd() Thread.Sleep(500) 'Debug.Print("SMS Sent!"); End Sub Private Sub PrintEnd() Dim bytesToSend As Byte() = New Byte(0) {} bytesToSend(0) = 26 sp.Write(bytesToSend, 0, 1) Thread.Sleep(200) 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?
Thanks
#29449 Serial Terminal
Posted by tknman0700 on 20 May 2012 - 10:56 PM in General Discussion
#29327 GPRS/SMS shield help please
Posted by tknman0700 on 17 May 2012 - 11:44 AM in General Discussion
#28412 Netduino Plus and Seedstudio GPRS Shield
Posted by tknman0700 on 02 May 2012 - 01:41 AM in Netduino Plus 2 (and Netduino Plus 1)
#28235 Netduino Plus and Seedstudio GPRS Shield
Posted by tknman0700 on 27 April 2012 - 09:38 PM in Netduino Plus 2 (and Netduino Plus 1)
I am however struggling with this device
http://www.seeedstud...l?cPath=132_134
I have located this helper wiki:
http://www.seeedstud...RS_Shield_v0.9b
I have located a helper library here:
http://netduino2seedgsm.codeplex.com/
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 serialPort.Open() 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.
#28051 BlinkyVB -- first Netduino app using Visual Basic
Posted by tknman0700 on 24 April 2012 - 07:32 PM in Visual Basic Support
Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Module Module1 Dim ledStatus As Boolean = False Dim led As New OutputPort(Pins.ONBOARD_LED, ledStatus) Public WithEvents boardButton As New InterruptPort(Pins.ONBOARD_SW1, False, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) Public Sub Main() Thread.Sleep(Timeout.Infinite) End Sub Private Sub boardButton_OnInterrupt(ByVal data1 As UInteger, ByVal data2 As UInteger, ByVal time As DateTime) Handles boardButton.OnInterrupt ledStatus = Not ledStatus led.Write(ledStatus) End Sub End Module
I am not sure I understand why this matters but it seems to run well now and demonstrates responding to event as opposed to sleep and timer.
#28050 BlinkyVB -- first Netduino app using Visual Basic
Posted by tknman0700 on 24 April 2012 - 07:29 PM in Visual Basic Support
I have had that too once. I deployed Microsoft.SPOT.Hardware.PWM to it by accident (it's not compatible with 4.2RC4). I had to re-flash my device, but since then, it works just fine.
Ok I reflased and it seems to at least let me deploy now but I dont understand what is wrong with my code trying to handle events.
#28049 Netduino Firmware v4.2.0 RC4 (Netduino + Netduino Plus)
Posted by tknman0700 on 24 April 2012 - 07:24 PM in Beta Firmware and Drivers
#28045 BlinkyVB -- first Netduino app using Visual Basic
Posted by tknman0700 on 24 April 2012 - 06:49 PM in Visual Basic Support
#28040 BlinkyVB -- first Netduino app using Visual Basic
Posted by tknman0700 on 24 April 2012 - 06:26 PM in Visual Basic Support
#28039 BlinkyVB -- first Netduino app using Visual Basic
Posted by tknman0700 on 24 April 2012 - 06:19 PM in Visual Basic Support
#28029 BlinkyVB -- first Netduino app using Visual Basic
Posted by tknman0700 on 24 April 2012 - 04:26 PM in Visual Basic Support
Any help is appreciated.
Namespace NetDuinoTogglePower Public Class Program Shared ledStatus As Boolean = False Shared led As New OutputPort(Pins.ONBOARD_LED, ledStatus) Public WithEvents boardButton As New InterruptPort(Pins.ONBOARD_SW1, False, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) Public Shared Sub Main() Thread.Sleep(Timeout.Infinite) End Sub Private Shared Sub boardButton_OnInterrupt(ByVal data1 As UInteger, ByVal data2 As UInteger, ByVal time As DateTime) Handles boardButton.OnInterrupt ledStatus = Not ledStatus led.Write(ledStatus) End Sub End Class End Namespace
This is my first vb program when I hit F5 VS tells me the target it not initialized rebooting... it does this every time. Is there something to this? I dont recall seeing this before.
Thanks
#28027 Netduino Firmware v4.2.0 RC4 (Netduino + Netduino Plus)
Posted by tknman0700 on 24 April 2012 - 04:12 PM in Beta Firmware and Drivers
#28023 Netduino Firmware v4.2.0 RC3 (all editions)
Posted by tknman0700 on 24 April 2012 - 03:27 PM in Beta Firmware and Drivers
#28021 How to install (or upgrade to) .NET Micro Framework v4.2 SDK
Posted by tknman0700 on 24 April 2012 - 03:19 PM in Beta Firmware and Drivers
#28020 Seeduino GPRS / GSM shield
Posted by tknman0700 on 24 April 2012 - 03:08 PM in Netduino 2 (and Netduino 1)
- Netduino Forums
- → tknman0700's Content
- Privacy Policy