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.

Baqs's Content

There have been 5 items by Baqs (Search limited from 28-April 23)


By content type

See this member's

Sort by                Order  

#39337 New to this : Trouble with AnalogInput with Firmware v4.2.0.1

Posted by Baqs on 14 November 2012 - 02:08 PM in Netduino 2 (and Netduino 1)

Hi Jaime. The problem could be in the method you are using to obtain the analog value. AnalogInputs have two methods to obtain the analog value: Read and RawRead. To use Read you must initialize the offset and scale properties in order to obtain a correct reading, this method returns a double by the way. Try replacing pot.Read() with pot.ReadRaw() which returns an unscaled int. That may solve the issue. Good luck!



#38834 Netduino Plus locks when using pointers

Posted by Baqs on 09 November 2012 - 10:50 AM in Netduino Plus 2 (and Netduino Plus 1)

Thanks Chris, worked perfectly!



#38830 Netduino Plus locks when using pointers

Posted by Baqs on 09 November 2012 - 10:12 AM in Netduino Plus 2 (and Netduino Plus 1)

When attempting to use pointers in a Netduino Plus I have locked the device in every attempt. For example, if I try to run the following code:

public static void Main()
{
   float testNumber = 5.25f;

   byte[] numberBytes = GetBytes(testNumber);
   for (int count = 0; count < numberBytes.Length; count++)
   {
      Debug.Print("Byte[" + count + "]=" + numberBytes[count]);
   }
}

public static unsafe byte[] GetBytes(float value)
{
   byte* pointerToFirstByte = (byte*)&value;
   byte[] resultBytes = new byte[4] { *pointerToFirstByte, *(pointerToFirstByte + 1), *(pointerToFirstByte + 2), *(pointerToFirstByte + 3) };
   return resultBytes;
}


the Netduino ends up locked and I have to erase it with MFDeploy. Is there any way to use pointers in the Netduino Plus?



#38812 VS hanging at "Preparing to deploy assemblies to the device"

Posted by Baqs on 09 November 2012 - 03:27 AM in Netduino Plus 2 (and Netduino Plus 1)

This is normal with NETMF devices, probably a problem with VS. I have had the same issue (frequently) with different boards (Netduino Plus, FEZ Spider and FEZ Panda II) all with the latest firmware. In case you fail to deploy after several attempts (happened once to me) simply unplug the device, close and reopen VS, and plug the device again, that fixed it. Update: In case VS still fails to communicate with your Netduino after a few attempts you might want to check this post: http://forums.netdui...p__216#entry216



#38811 Network to Host order

Posted by Baqs on 09 November 2012 - 03:17 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi After searching for a while I have been unable to find the equivalent of the BitConverter class in NETMF. I am totally new to NETMF programming so until now I assumed there was an equivalent class somewhere because I find it hard to believe that an embedded networked device does not have support for byte ordering to transmit/receive binary data. But after reading a few articles and browsing the .NET Micro Framework Platform SDK I am becoming convinced that there is no such class. Before I write my own class using pointers, which seems as elegant as putting a set of bicycle tires on an F1 car, I want to make sure that I am not missing something. So my question is Is there an equivalent of the BitConverter class in .NET Micro Framework, i.e. is there a class which will let me access the bytes of an int, float, etc, as an array of bytes?




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.