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.

Jeffa

Member Since 07 Nov 2011
Offline Last Active Jul 21 2013 06:28 PM
-----

Topics I've Started

AnalogInput constructor

08 July 2013 - 04:57 PM

I'm dusting off my Netduino 2 Plus... In a previous project that I authored, I used a syntax of

static AnalogInput a0 = new AnalogInput((Cpu.AnalogChannel)Cpu.AnalogChannel.ANALOG_0, 3.3, 0.0, 10);

I had to reLoad it from gitHub to realize / remember it was a version sdk4.3 project.

 

I'm working in a 4.2 project now* duplicating the code for another project. Currently my Netduino 2 Plus is configured as

 

SolutionReleaseInfo.solutionVendorInfo: Netduino Plus 2 (v4.2.2.2) by Secret Labs LLC
SoftwareVersion.BuildDate:              Jan 26 2013
 
I get an exception with the constructor above and with (AnalogChannels.ANALOG_PIN_A0, 3.3, 0.0, 10) for a constructor. If I use 
static AnalogInput a0 = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);

I get the pin, but my math is wrong in the read. I'd rather fix it in the constructor than the code.

 
Is there a syntax in 4.2 that will create an AnalogPin with the same characteristics as that of the constructor for AnalogInput I used in the 4.3 project? 
 
Thanks, - jeffa
 
 
* maybe I should reFlash for 4.3. I haven't been in vs2010 much lately. And now we have 2013 preview. Many code samples are in 4.2 syntax...
 

DateTime.UtcNow bug

20 February 2013 - 02:13 AM

For a couple days now I've been reading about ISO 8601 Date and Time representations. This Wikipedia article has some good information. 

 

As of about version 4 .net has standardized on ISO 8601 for representation of DateTime when serializing. See this article by Scott Hanselman

 

In an application I have code that writes DateTime.UtcNow which is apparently creating an incorrectly formatted serialization of DateTime. The only allowable alpha Timezone is 'Z' for zulu. Others are expressed as numeric offsets.

 

Note these two Json serializations. The first from a .net windows phone application (correct), the second from my ndp2 (incorrect) project. Both reporting to Azure.

 

 [{"id":1,"DataLoggerName":"Ben Walkin","Time":"2013-02-19T18:39:51.733Z",[{"id":1,"DataLoggerName":"JHANetDuino","Time":"2013-02-19T16:46:55.205K",

I hope to work around this problem by learning how to set a Timezone in .netmf. However using DateTime.UtcNow should not reflect the local time. Correct?

 

I documented some of my travails in this stackoverflow question. And earlier in these forums in this article.

 

 

 

 

 

 


ISO 8601 trim DateTime milliseconds

19 February 2013 - 06:09 PM

I'm attempting to create table data in Azure with mobile services. Got it working. It looks to me that my ndp2 is producing and persisting valid ISO 8601 DateTime to azure However the json.net JsonConvert.DeserializeObjectAsync in my Metro application barfs on the DataTime Deserialize. Please see this Stackoverflow quesion would appreicate it if you have experience with javascript and .net json.net.

 
While trying to debug it or otherwise get it to work I decided to
 
1) Change the DateTime.Now to DateTime.UtcNow 
      The DateTime retuned in Json from Azure still uses 'K' rather than what I thought would be 'Z':
            "2013-02-19T16:46:55.205K"
 
2) Trim the milliseconds off the DateTime before I persist. Apparently no Parse in the .netmf DateTime. Is there a way to tell DateTime to drop the milliseconds? 
 
I use Stephan's Toolbox.NETMF.NET.SNTP_Client and set the date from ntp. (some day I'd like to understand more about TimeZone in .netmf no SetTimeZone)
 
            // Initializes the time client            SNTP_Client TimeClient = new SNTP_Client(new IntegratedSocket("time-a.nist.gov", 123));            // ExtendedTimeZone.SetTimeZone(TimeZoneId.Arizona); // not supported            TimeClient.Synchronize();

 

The azure update. What might I use for DateTime.Parse as it is apparently unsupported? Or trim milliseconds from DateTime? 

 

        public static void AzureUpdateThread()        {            while (true)            {                string strTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");                DateTime dateTimeMinusMilliSeconds = DateTime.Parse(strTime); // Apparently no DateTime.Parse                HistoricalTemperatureDataForAzure htdForAzure = new HistoricalTemperatureDataForAzure()                {                    DataLoggerName = DataLoggerName,                    // Time = DateTime.Now,                    // Time = DateTime.UtcNow,                    Time = dateTimeMinusMilliSeconds,                    Temperature0 = temperature0,                    Temperature1 = 0                };                var json = MobileService.GetTable("HistoricalTemperatureData").Insert(htdForAzure);                Thread.Sleep(5 * 60 * 1000);            }

 

 

 
 
 

Inconsistent behavior; P1 vs: P2

18 February 2013 - 05:45 AM

I am noticing what appears to be some inconsistent behavior between my Netduino Plus 1 and my new Netduino Plus 2.

 

Most of the weekend I have been working on a Socket implementation to serve XML from a Netduino. It's been deploying and running for the most part flawlessly and consistently the entire weekend with many modifications and deploys to a single Netduino plus 1. The code is available on my gitHub account: here

 

I decided to continue development and add Azure mobile services. I ran out of room to deploy on the Netduino 1 Plus (Note that I haven't merged the Azure code up to gitHub). I had just purchased a new Netduino Plus 2. Attached and deployed fine, but right away it just seemed inconsistent in starting up. If I just fired it up it hung or otherwise failed while setting the clock from NTP, or listening with the Socket. If I set a break point on Main() and stepped through, it would run dependent on how I stepped into or over breakpoints. However without setting breakpoints it rarely if ever ran as expected and had run on the Netduino Plus 1 before growing the code to large to fit. 

 

Any ideas or comments? Below I include output from MfDeploy for both 'duinos. I am running SDK 4.3 (RTM) and Netduino SDK v4.30 (February 2013) in vs2012Ultimate. 

 

 

Netduino 2 plus
 
Pinging... TinyCLR
HalSystemInfo.halVersion:               4.2.0.0
HalSystemInfo.halVendorInfo:            Netduino Plus 2 (v4.2.2.0) by Secret Labs LLC
HalSystemInfo.oemCode:                  34
HalSystemInfo.modelCode:                177
HalSystemInfo.skuCode:                  4102
HalSystemInfo.moduleSerialNumber:       00000000000000000000000000000000
HalSystemInfo.systemSerialNumber:       0000000000000000
ClrInfo.clrVersion:                     4.2.0.0
ClrInfo.clrVendorInfo:                  Netduino Plus 2 (v4.2.2.0) by Secret Labs LLC
ClrInfo.targetFrameworkVersion:         4.2.0.0
SolutionReleaseInfo.solutionVersion:    4.2.2.0
SolutionReleaseInfo.solutionVendorInfo: Netduino Plus 2 (v4.2.2.0) by Secret Labs LLC
SoftwareVersion.BuildDate:              Jan  9 2013
SoftwareVersion.CompilerVersion:        410894
FloatingPoint:                          True
SourceLevelDebugging:                   True
ThreadCreateEx:                         True
LCD.Width:                              0
LCD.Height:                             0
LCD.BitsPerPixel:                       0
AppDomains:                             True
ExceptionFilters:                       True
IncrementalDeployment:                  True
SoftReboot:                             False
Profiling:                              False
ProfilingAllocations:                   False
ProfilingCalls:                         False
IsUnknown:                              False
 
netduino 1 plus
 
Pinging... TinyCLR
AutoNegotiate complete
HalSystemInfo.halVersion:               4.2.0.0
HalSystemInfo.halVendorInfo:            Netduino Plus (v4.2.0.1) by Secret Labs LLC
HalSystemInfo.oemCode:                  34
HalSystemInfo.modelCode:                177
HalSystemInfo.skuCode:                  4097
HalSystemInfo.moduleSerialNumber:       00000000000000000000000000000000
HalSystemInfo.systemSerialNumber:       0000000000000000
ClrInfo.clrVersion:                     4.2.0.0
ClrInfo.clrVendorInfo:                  Netduino Plus (v4.2.0.1) by Secret Labs LLC
ClrInfo.targetFrameworkVersion:         4.2.0.0
SolutionReleaseInfo.solutionVersion:    4.2.0.0
SolutionReleaseInfo.solutionVendorInfo: Netduino Plus (v4.2.0.1) by Secret Labs LLC
SoftwareVersion.BuildDate:              Sep 19 2012
SoftwareVersion.CompilerVersion:        410894
FloatingPoint:                          True
SourceLevelDebugging:                   True
ThreadCreateEx:                         True
LCD.Width:                              0
LCD.Height:                             0
LCD.BitsPerPixel:                       0
AppDomains:                             True
ExceptionFilters:                       True
IncrementalDeployment:                  True
SoftReboot:                             True
Profiling:                              False
ProfilingAllocations:                   False
ProfilingCalls:                         False
IsUnknown:                              False

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.