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.

alharlow's Content

There have been 6 items by alharlow (Search limited from 30-March 23)


By content type

See this member's

Sort by                Order  

#65296 Netduino Plus 2 Firmware v4.3.1

Posted by alharlow on 04 July 2016 - 08:07 PM in Netduino Plus 2 (and Netduino Plus 1)

I have a ND2P and want to move to VS2013 (currently using VS2010) MFv4.3.  Reading through these posts I apparently need to update the firmware on the ND2P and install the MFv4.3 on my computer.  I see the very first post here is a 'How To'.  Is that post still accurate - I see that it is more than 2 years old?




#64129 Stops writing to database

Posted by alharlow on 16 September 2015 - 03:48 AM in Netduino Plus 2 (and Netduino Plus 1)

I went to the site you provided and downloaded the code, swapped it in for my 'webrequest' class.  Modified it slightly for my situation and ran it.  It runs fine the first time through but on the second time around it hangs on the line after the debug.print("X4") line.  Code shown below.  This is a static class.  Do the objects created within the class get recreated the second time through the code?

 

 

//Developed for the book
//  "Getting Started with the Internet of Things", by Cuno Pfister.
//  Copyright 2011 Cuno Pfister, Inc., 978-1-4493-9357-1.
//
// Version 4.3, for the .NET Micro Framework release 4.3.
 
using Microsoft.SPOT;
using System;
using System.IO;
using System.Net;
using System.Text;
 
namespace App4ReadTemp
{
    public static class XivelyClient
    {
        const string baseUri = "http://www..............php";
 
        public static void Send(float ftemp)
        {
            Debug.Print("time: " + DateTime.Now);
            Debug.Print("memory available: " + Debug.GC(true));
            try
            {
                using (var request = CreateRequest(ftemp))
                {
                    request.Timeout = 5000;     // 5 seconds
                    // send request and receive response
                    Debug.Print("X6");
                    using (var response =
                        (HttpWebResponse)request.GetResponse())
                    {
                        Debug.Print("X7");
                        HandleResponse(response);
                        Debug.Print("X8");
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.ToString());
            }
        }
 
        static HttpWebRequest CreateRequest(float ftemp)
        {
            ftemp = (float)(System.Math.Round((double)ftemp));
            string Temp = ftemp.ToString();
            string postData = "temp1=" + Temp;
 
            byte[] buffer = Encoding.UTF8.GetBytes(postData);
 
            Debug.Print("X1");
            var request = (HttpWebRequest)WebRequest.Create(baseUri);
            Debug.Print("X2");
 
            // request line
            request.Method = "PUT";
 
            // request headers
            request.ContentLength = buffer.Length;
            request.ContentType = "application/x-www-form-urlencoded";
 
            // request body
            Debug.Print("X3");
            using (Stream stream = request.GetRequestStream())
            {
                Debug.Print("X4");
                stream.Write(buffer, 0, buffer.Length);
                Debug.Print("X5");
            }
 
            return request;
        }
 
        public static void HandleResponse(HttpWebResponse response)
        {
            Debug.Print("Status code: " + response.StatusCode);
        }
    }
}



#64088 Stops writing to database

Posted by alharlow on 10 September 2015 - 11:52 PM in Netduino Plus 2 (and Netduino Plus 1)

I did the onboard LED thing.  The LED stops blinking when it hangs (the LED stays on when it hangs).

Also used the debug.GC(true) call.  The memory available stays around 94,448 so apparently its not a memory leak.

I added some additional debug.print statements and found that it's hanging on the dataStream = request.GetRequestStream(); in the DoThePost method.  My understanding is that that statement is creating an object.

 

I have attache the code.

 

Help!

Attached Files




#64054 Stops writing to database

Posted by alharlow on 09 September 2015 - 12:52 AM in Netduino Plus 2 (and Netduino Plus 1)

I have ND2+ reading a temperature sensor then calling a PHP web page on Apache using HTTP.  The page writes the temp to a mySQL database.  Works fine for maybe a day or two then just stops updating the database.  I don't know how to tell if the ND2+ is still doing its thing or if it's hung.  If I'm running it through the Visual Studio debugger I have a few debug.print statements that stop appearing like the ND2+ is hung.

 

Anyone have any ideas?




#63805 Post to HTTPS Rest URL

Posted by alharlow on 07 August 2015 - 01:30 AM in Netduino Plus 2 (and Netduino Plus 1)

I have some code very similar to this that repeatedly reads a temperature sensor and saves the value to a database.  It has the 'keepalive' parameter set to 'true'.  I assume this is so it can reuse the HTTP connection.  Do you know if this is true?  But each time the process reenters this routine it will reexecute the WebRequest.Create command and create a new object.  Is this new object being used by the program to communicate with the HTTP object on the server that is still there because of the 'keepalive=true' parameter?




#63804 reg. Visual studio 2010

Posted by alharlow on 07 August 2015 - 01:10 AM in General Discussion

What's the difference between 'firmware' and the NETMF ?





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.