Netduino home hardware projects downloads community

Jump to content


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

baxter's Content

There have been 63 items by baxter (Search limited from 12-May 23)


By content type

See this member's


Sort by                Order  

#60188 RS-232 Pins

Posted by baxter on 22 September 2014 - 07:12 PM in Netduino Mini

Question 1 is yes, but  cross connect them TX-RX, RX-TX and GND.  You do need a TTL/RS232 adapter for COM1 if you want to use your RS232 cable for both ports.

 




#59416 IE support with this forum software - copy and paste doesn't work

Posted by baxter on 27 July 2014 - 04:28 PM in Netduino Plus 2 (and Netduino Plus 1)

This has been frustrating for me also. Maybe it is both an IE11 and a Forum problem. If I login with Chrome, pasting this this message from Notepad into a  Reply box works just fine.




#60509 Function for a curve?

Posted by baxter on 22 October 2014 - 07:15 PM in General Discussion

Here is a nice sequential mean and variance estimator,
http://www.johndcook..._deviation.html

Just sample the analog input or distance for X ms and you have the mean value together with the error estimate.




#58971 Bitconverter class causing crash/irresponsiveness.

Posted by baxter on 02 July 2014 - 12:48 AM in Netduino Plus 2 (and Netduino Plus 1)

You can also use,

byte B = 0xac;
String S = B.ToString("X2");
Debug.Print(S); //--> AC



#60332 Scheme-it

Posted by baxter on 03 October 2014 - 12:56 AM in General Discussion

There's  easyEDA,

http://easyeda.com/

 

It was free when I signed up, but I haven't used it much. Also, LTspice IV,

http://www.linear.co...tools/software/




#58925 convert data types to byte[] and back for streaming

Posted by baxter on 27 June 2014 - 05:47 AM in General Discussion

I previously confronted this issue and found a couple of references,
https://www.ghielect...3/serialization
http://bytes.com/top...ture-byte-array

I copied the structure serialize code (near the bottom of the page) from the second reference and it compiles
just fine on the Mini using firmware 4.2.0.1.

Imports Microsoft.SPOT
Imports Microsoft.SPOT.Hardware
Imports SecretLabs.NETMF.Hardware
Imports SecretLabs.NETMF.Hardware.NetduinoMini
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic.Constants
Imports System.Text
Imports System.Threading
Imports System.Collections

Module Module1
    Sub Main()
        Dim s As Struct = New Struct
        Dim ms As MyStruct = New MyStruct With {.el1 = 1, .el2 = 2, .el3 = 3}
        Dim sb() As Byte = Struct.Convert(ms)
    End Sub

    <StructLayout(LayoutKind.Sequential, Pack:=1, Size:=12)>
    Private Structure MyStruct
        Dim el1 As Byte
        Dim el2 As Int16
        Dim el3 As Byte
    End Structure

    Public Class Struct
    'Charles Law 
    'http://bytes.com/topic/visual-basic-net/answers/357098-convert-structure-byte-array

        Public Shared Function Convert(ByVal MyStruct As Object) As Byte()
            Dim al As ArrayList
            Dim Fields As FieldInfo() = MyStruct.GetType.GetFields
            al = New ArrayList

            For Each fld As FieldInfo In Fields
                If fld.FieldType.Equals(GetType(Byte)) Then
                    ' Add byte to array list
                    al.Add(CByte(fld.GetValue(MyStruct)))

                ElseIf fld.FieldType.Equals(GetType(Int16)) Then
                    ' Add 16-bit value to array list
                    Dim i16 As Int16

                    i16 = CType(fld.GetValue(MyStruct), Int16)
                    al.Add(CByte(i16 >> 8))
                    al.Add(CByte(i16 And &HFF))
                Else
                    Throw New Exception("Cannot convert type.")
                End If
            Next fld

            Return DirectCast(al.ToArray(GetType(Byte)), Byte())

        End Function
    End Class

    Public Function PrintArray(title As String, ByVal Arr() As Byte) As String
        Dim s As String = title & vbCrLf
        For i = 0 To Arr.Length - 1
            s &= "i = " & i.ToString & "  " & "Byte = " & Arr(i).ToString("X2") & vbCrLf
        Next
        Return s.Trim
    End Function


End Module

I didn't run it for this post because my Mini is in storage. I lost interest in this because I found for my purposes it was easier to just convert the data type to a string and then convert the string to bytes and then reverse this to go back to the data type (not too efficient, but it works)




#59735 Netduino Mini $10

Posted by baxter on 16 August 2014 - 02:02 AM in Netduino Mini

Thanks ... Great price, bought one.




#59169 New Modules Seen in the Wild

Posted by baxter on 11 July 2014 - 09:27 PM in Netduino Go

 

Mine has sat unused in its box since I excitedly bought one when it first came out. I expect it to stay there.

Mine also 




#59577 Serial port issues

Posted by baxter on 06 August 2014 - 02:29 AM in Netduino 2 (and Netduino 1)

You need to add,

using System.IO.Ports;




#62108 Serial Port read data

Posted by baxter on 14 April 2015 - 05:57 PM in Netduino Plus 2 (and Netduino Plus 1)

I was using this with an ESP8266 AT command set driver (since abandonded in favor of the Lua firmware). Just instantiate the port without an event handler and then receive serial in a wait loop.

Public Sub New(ByVal ComPort As String, _
                   Optional ByVal baud As Integer = 9600)
        Port = New SerialPort(ComPort, baud, Parity.None, 8, StopBits.One)

        With Port 'note no event handler
            .Handshake = Handshake.None
            .WriteTimeout = 200
            .ReadTimeout = 200
            .Open()
        End With
        InputString = String.Empty
        'need to change if not 9600
        If (baud <> _DefaultBaud) Then '9600 is default baud rate of ESP8266 firmware (0.9.2.2)
            _Baud = baud
        End If
    End Sub

---------------

Public Function GetFromESP(Eot As String) As String
        'this is the main reader for ESP responses. It will wait for the expected Eot or
        'a socket exception will be thrown if the response contains, ERROR or Unlink

        Dim n As Integer = 0
        Dim response As String = String.Empty
        InputString = String.Empty
        While (True)
            If (Port.BytesToRead > 0) Then
                Dim buff = New Byte(Port.BytesToRead - 1) {}
                n = Port.Read(buff, 0, Port.BytesToRead)
                Thread.Sleep(200)
                InputString &= New String(Encoding.UTF8.GetChars(buff))
                'Debug.Print("Inputstring: " & InputString)

                If (Contains(InputString, Eot)) Then 'expected return
                    Exit While
                    'Trap for socket connect to inactive server
                ElseIf (Contains(InputString, "CIPSTART") And _
                       (Contains(InputString, "ERROR") _
                        Or Contains(InputString, "Unlink"))) Then
                    response = InputString
                    InputString = String.Empty
                    Throw (New ESPexception("Socket can't connect: GetFomESP returned ERROR Unlink"))
                End If
                Thread.Sleep(50) 'need this delay (maybe more)
            End If
        End While
        response = InputString
        InputString = String.Empty
        Return response
    End Function



#62970 Unique device ID

Posted by baxter on 29 May 2015 - 04:27 PM in Netduino Plus 2 (and Netduino Plus 1)

See post #8,
http://forums.netdui...uino-unique-id/




#60115 Netduino 2 and Dfrobot GSM/GPS Shield

Posted by baxter on 14 September 2014 - 06:25 PM in Netduino 2 (and Netduino 1)

I just bought a discounted Seeed Gprs at Radio Sack,
http://www.seeedstud...erface_Function
I now find that Seeed is selling a new model, but the basic functionality is the same as the old one.

 

The serial setup is different from yours, but I think they are doing the same thing. I have mine with the jumpers set to hardware. The shield is plugged in to the Netduino and Netduino is directly talking to the module via COM1. If you want to talk to the module from a PC terminal, configure yours for hardware, but don't plug it in to the Netduino.and take power externally. Then connect a USB-TTL cable to D0, D1 on the shield. The USB to RS232 cable you linked is wrong for this application.  You might look at these depending upon the versatility you want ( you can get a cheaper USB to TTL  adapter on ebay),

 

https://www.sparkfun.../products/12977

https://www.sparkfun.../products/11736

 

My driver in VB seems to working ok with simple commands,

        SeeedGprs.SendReceiveCmd("AT") 'can communicate
        Debug.Print("CmdSent: " & SeeedGprs.CmdSent)
        Debug.Print("CmdAnswer: " & SeeedGprs.CmdResponse)
        Thread.Sleep(400)
        SeeedGprs.SendReceiveCmd("AT+COPS?", , 400) 'Carrier info
        Debug.Print("CmdSent: " & SeeedGprs.CmdSent)
        Debug.Print("CmdAnswer: " & SeeedGprs.CmdResponse)
        Thread.Sleep(400)
        SeeedGprs.SendReceiveCmd("AT(+CSQ)") 'signal quality
        Debug.Print("CmdSent: " & SeeedGprs.CmdSent)
        Debug.Print("CmdAnswer: " & SeeedGprs.CmdResponse)


CmdSent: AT
CmdAnswer:  OK 
CmdSent: AT+COPS?
CmdAnswer: PS: 0,0,"T-Mobile"  OK 
CmdSent: AT(+CSQ)
CmdAnswer: OR 
 

To go much further, I need an activated SIM card. The phones I have use a micro SIM and these modules take a standard size. I guess the answer is to just use the carrier for a micro SIM in in an activation kit.

 




#59740 Servers Ultimate Pro Free Android App from Amazon

Posted by baxter on 16 August 2014 - 07:15 PM in General Discussion

Don't know much about it, but may be useful with a Plus 1 or 2.

http://www.amazon.co...e/dp/B00E00C70C
http://slickdeals.ne...free-on-amazon?





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.