Does anyone have some working sample code for this module as I’m having trouble getting it to work (I’m using a Grove - Sound Sensor with a Fez Spider board, but have a number of Grove sensors so any samples would be helpful) as it keeps telling me it needs an A socket, and then when I plug it into an A socket, then it tells me it needs an K socket, and then when I plug it into a K socket then it tells me I need an A socket etc. For example the code I’m using is as follows:
[code]The problem I’m having is when I plug it into port 10 which is a A port I get:
An unhandled exception of type ‘Gadgeteer.Socket.InvalidSocketException’ occurred in Gadgeteer.dll
Additional information: Module GroveExpansion cannot use socket 10 because it requires a socket supporting type ‘K’
But when I plug it into say port 4 which is a K port I get:
An unhandled exception of type ‘Gadgeteer.Socket.InvalidSocketException’ occurred in Gadgeteer.dll
Additional information: Socket 4 does not support type ‘A’ required by GroveExpansion module, so you can see its rather messed up.
Here is the code I’m trying to get running.
using Microsoft.SPOT;
using GT = Gadgeteer;
using GTI = Gadgeteer.Interfaces;
namespace GroveTest1
{
public partial class Program
{
private GTI.AnalogInput _input;
void ProgramStarted()
{
_input = groveExpansion.SetupAnlogInput(GT.Socket.Pin.Three);
GT.Timer _timer = new GT.Timer(500);
_timer.Tick += new GT.Timer.TickEventHandler(_timer_Tick);
_timer.Start();
}
void _timer_Tick(GT.Timer timer)
{
Debug.Print("tick");
double volts = _input.ReadVoltage();
double proportion = _input.ReadProportion();
Debug.Print("volts: " + volts.ToString());
Debug.Print("proportion: " + proportion.ToString());
}
}
}
I believe the Grove - Sound Sensor would require a Analog Input but any help would be appreciated.
Thanks