Hi I have a Problem with my Hydra. I will use the MathEx Library from GHI. But When I include the library in my Project I get this Error:
“System.Exception” in Microsoft.SPOT.Hardware.dll "
the Same on my Panda2 works fine! What make I wrong so that I don´t can use this? Is there an other
math library with sin,cos,tan,asin,acos,atan…
thanks for your Help
Here my code:
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;
using GHIElectronics.OSH.NETMF.Hardware;
using GHIElectronics.NETMF.System;
using MSpot = Microsoft.SPOT.Hardware;
using Gadgeteer.Modules.GHIElectronics;
namespace GadgeteerApp3
{
public partial class Program
{
public static MSpot.OutputPort output = new MSpot.OutputPort((MSpot.Cpu.Pin)FEZHydra.Pin.PD11,false);
// This method is run when the mainboard is powered up or reset.
void ProgramStarted()
{
/*******************************************************************************************
Modules added in the Program.gadgeteer designer view are used by typing
their name followed by a period, e.g. button. or camera.
Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
button.ButtonPressed +=<tab><tab>
If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
timer.Tick +=<tab><tab>
timer.Start();
*******************************************************************************************/
button.ButtonPressed += new Gadgeteer.Modules.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed);
// Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
Debug.Print("Program Started");
}
void button_ButtonPressed(Gadgeteer.Modules.GHIElectronics.Button sender, Gadgeteer.Modules.GHIElectronics.Button.ButtonState state)
{
while (button.IsPressed)
{
double d1 = MathEx.Sin(123.543);
double d2 = (234.123 + MathEx.Sqrt(12342.23 - 4 * 123.123 * 123.12)) / 123.23;
double d3 = (234.123 + MathEx.Sqrt(12342.23 - 4 * 123.123 * 123.12)) / 123.23;
double d5 = (234.123 + MathEx.Sqrt(12342.23 - 4 * 123.123 * 123.12)) / 123.23;
output.Write(false);
output.Write(true);
}
}
}
}