I am trying to use GHIElectronics.NETMF.System.Util.ExtractValueFromArray in the GHIElectronics.NETMF.System assembly but I receive the following exception when I use the following code:
I am using a FEZ Spider. Steven, that code block is the entire code that does not work. I have also tried to insert a value using InsertValueIntoArray and receive the same exception, here is that code:
byte[] testInsertBytes = new byte[4];
GHIElectronics.NETMF.System.Util.InsertValueIntoArray(10F, testInsertBytes, 0);
Can anyone else try using ExtractValueFromArray or InsertValueIntoArray methods on a spider?
I have tried both insert and remove in a gadgeteer project. Both work for me. Is your project a gadgeteer project? Have you checked to make sure you have the latest firmware?
Here is the code I used:
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
namespace forum_extract_test
{
public partial class Program
{
void ProgramStarted()
{
byte[] testInsertBytes = new byte[4];
GHIElectronics.NETMF.System.Util.InsertValueIntoArray(10F, testInsertBytes, 0);
float val;
byte[] bytesToConvert = new byte[4] { 68, 47, 0, 0 };
GHIElectronics.NETMF.System.Util.ExtractValueFromArray(out val, bytesToConvert, 0);
// Do one-time tasks here
Debug.Print("Program Started");
}
}
}
hrm … just tried your exact code in a new Gadgeteer project and I get the same exception when I use the emulator. When I run on the device it seems to work …
The assembly for the methods is located in: C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\GHIElectronics.NETMF.System.dll and is version 4.1.7.0