I am beginner with my board, FEZ Cerbuino Bee, Firmware 4.2, VS2010, (QEF2) 4.2
The code is exactly from the tutorial for analog input:
Unfortunatily I had these exception:
An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type ‘System.ArgumentException’ occurred in Microsoft.SPOT.Hardware.dll
I’ve tried to modify the following:
from to
ANALOG_7 => ANALOG_0
using GHI.Premium.Hardware; => using GHI.OSHW.Hardware;
Well, since I am not familiar with Gadgeteer Apps, I got this Errs
I solved the first one by modifying it to be from:
Mainboard = new GHIElectronics.Gadgeteer.FEZCerbuinoBee();
To:
Mainboard = new GHIElectronics.Gadgeteer.FEZCerberus();
but the second one is still there!!
It seems that Gadgeteer is a cool GUI tool, but actually I need the simplest analog reading.
I also was trying to modify my code (NetMF Console) by replacing my initialization:
new AnalogInput((Cpu.AnalogChannel)Cpu.AnalogChannel.ANALOG_7, 3.3,0.0,10);
with yours:
new AnalogInput(GHI.OSHW.Hardware.FEZCerbuino.Pin.AnalogIn.A0);
and there was no errors but the same exceptions appeared!!
I can’t believe that I spent all this time just to read analog input
(you’ve got a reference to FEZCerberus - subtle, but diffferent)
Then you need to make sure Program.cs contains a ProgramStarted() method (one was created automatically for you when you greated the new Gadgeteer application)
That could look like this:
void ProgramStarted()
{
Debug.Print("Program Started");
var analogInput = new Microsoft.SPOT.Hardware.AnalogInput(Cpu.AnalogChannel.ANALOG_0, 12);
var analogValue = analogInput.Read();
Debug.Print("Analog Input value was " + analogValue);
}
Also worth noting the obvious that while it’s fine to put your own code into Program.Generated.cs for quick and dirty testing it will be overwritten when the file is regenerated (any time you make changes to the Program.gadgeteer.diagram canvas
Exactly that was the problem, I don’t have:
GHIElectronics.Gadgeteer,FEZCerbuinoBee()
and all what I have is:
GHIElectronics.Gadgeteer,FEZCerberus()
Anyway, I left the current PC and I installed VS2010 on my laptop again (and MF QEF2 and GHI NET MF 4.2 as well), and I found it there somehow!!
image #1:
What I had in PC (Don’t care about it for know)
image #2:
what I got in the Laptop!!
Err:
‘GadgeteerApp1.Program’ does not contain a definition for ‘ProgramStarted’ and no extension method ‘ProgramStarted’ accepting a first argument of type ‘GadgeteerApp1.Program’ could be found (are you missing a using directive or an assembly reference?) c:\users\salman\documents\visual studio 2010\Projects\GadgeteerApp1\Program.generated.cs 27 21 GadgeteerApp1