I am getting exceptions from the Gyro module running on a Hydra+.
With this code;
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Hardware;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace HydraTest2
{
public partial class Program
{
// 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();
*******************************************************************************************/
// Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
Debug.Print("Program Started");
gyro.Calibrate();
gyro.MeasurementComplete += gyro_MeasurementComplete;
gyro.StartTakingMeasurements();
}
void gyro_MeasurementComplete(Gyro sender, Gyro.MeasurementCompleteEventArgs e)
{
Debug.Print("X= " + e.X.ToString("F0"));
Debug.Print("Y= " + e.Y.ToString("F0"));
Debug.Print("Z= " + e.Z.ToString("F0"));
Debug.Print("Temp= " + e.Temperature.ToString("F0"));
}
}
}
I get the following output;
Program Started
X= 0
Y= 0
Z= -0
Temp= 20
X= 0
Y= 0
Z= 0
Temp= 20
X= -0
Y= 0
Z= -0
Temp= 21
X= 0
Y= 0
Z= 0
Temp= 21
X= 0
Y= 0
Z= 0
Temp= 20
X= 0
Y= -0
Z= 0
Temp= 20
X= 0
Y= 0
Z= 0
Temp= 21
X= 0
Y= 0
Z= 0
Temp= 20
X= 0
Y= -0
Z= 0
Temp= 20
X= 1
Y= -0
Z= -0
Temp= 20
X= 0
Y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temp= 21
X= 0
Y= 0
Z= -0
Temp= 20
X= 0
Y= 0
Z= 0
Temp= 21
X= 0
Y= 0
Z= -0
Temp= 20
X= 0
Y= 0
Z= 0
Temp= 20
X= 15
Y= -5
Z= -52
Temp= 21
X= 27
Y= -4
Z= -3
Temp= 21
X= 30
Y= -20
Z= -56
Temp= 20
X= 46
Y= -9
Z= -60
Temp= 20
X= 11
Y= -26
Z= -7
Temp= 20
X= -31
Y= 0
Z= 109
Temp= 21
X= -17
Y= -30
Z= -88
Temp= 20
X= -163
Y= -3
Z= 68
Temp= 21
X= -108
Y= -15
Z= 47
Temp= 21
X= -36
Y= -5
Z= 16
Temp= 21
X= 24
Y= -13
Z= -38
Temp= 21
X= 64
Y= 35
Z= 31
Temp= 21
X= 94
Y= -2
Z= -117
Temp= 21
#### Exception System.ApplicationException - 0x00000000 (4) ####
#### Message: SoftwareI2C: Exception writing to device at address 104 - perhaps device is not responding or not plugged in.
#### Gadgeteer.SocketInterfaces.NativeI2CBus::Execute [IP: 004e] ####
#### Gadgeteer.SocketInterfaces.NativeI2CBus::WriteRead [IP: 0073] ####
#### Gadgeteer.SocketInterfaces.I2CBus::WriteRead [IP: 0022] ####
#### Gadgeteer.Modules.GHIElectronics.Gyro::Read [IP: 0016] ####
#### Gadgeteer.Modules.GHIElectronics.Gyro::OnInterrupt [IP: 0006] ####
#### Gadgeteer.SocketInterfaces.NativeInterruptInput::OnPortInterrupt [IP: 0008] ####
A first chance exception of type 'System.ApplicationException' occurred in Gadgeteer.dll
An unhandled exception of type 'System.ApplicationException' occurred in Gadgeteer.dll
Additional information: SoftwareI2C: Exception writing to device at address 104 - perhaps device is not responding or not plugged in.
The program '[2] Micro Framework application: Managed' has exited with code 0 (0x0).
It seems to be related to when I start moving the gyro around, however if I send the output to an N18 I get a load of random results and then an exception without moving the gyro at all. This leads me to think that it’s an issue with the Hydra’s digital I/O maybe?
Any help is much appreciated.