FEZ Cerbuino Bee error occurred in Microsoft.SPOT.Hardware.dll"

“An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll”

I have been working with cerbuino bee for a while only using digital I/O and using serial port without troubles, but now im trying to figure out how to use analog I/O and I started to get this code from the tutorial

using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.OSHW.Hardware;
using System.IO.Ports;

namespace analog
public class Program
public static void Main()
PWM MyFader = new PWM(Cpu.PWMChannel.PWM_3, 10000, 0.1, false);
AnalogInput POTknob = new AnalogInput(Cpu.AnalogChannel.ANALOG_7, 1.0, 0.0, 10);
double POTknobReadout = 0.0;

        while (true)
            POTknobReadout = POTknob.Read();

            MyFader.DutyCycle = POTknobReadout;



What line throws the exception?

AnalogInput POTknob = new AnalogInput(Cpu.AnalogChannel.ANALOG_7, 1.0, 0.0, 10);

If you check out http://www.ghielectronics.com/docs/45/fez-cerbuino-bee-developer you can see the enums for the pins including Analog Input - might give you some hints or options.

yeah i already check the pins as well, but anyway I just erased: “, 1.0, 0.0, 10” from the line that the exception appears and compiled well, so I did the connections and the analog inputs works well with pot, even the PWM outputs, i have no idea what i’ve erased but for this way works

Here’s a tip that might help.

In Visual studio, when you copy and paste in someone else’s text, you basically get someone else’s text and nothing else. If however you paste it in, then if you don’t understand what it’s doing or why, go to the line beforehand, and start typing the same statement. This way, Intellisense will help you out and show you what the parameters in your command are, and also whether there are optional commands that take more or less parameters.

In this case you’ll be able to see what those extra parameters were for, and then decide what you might need to do differently without them