The NETMF guide ebook was updated

Since we have moved all tutorials to the wiki and we have a nice “tutorial” page here Support – GHI Electronics we decided to update book to be short and simple. Something a reader can go through in an evening.

So here it is http://www.ghielectronics.com/downloads/FEZ/Beginners%20guide%20to%20NETMF.pdf

The other 3 books are on my “to do” list as well. I hope this will help beginners get started and will help experts in finding things faster.

Downloaded to my HTC Flyer for some bedtime reading! I know it’s not meant to be used for gadgeteer devices, but I always like to know what’s going on behind the scenes, and this books seems to be a nice starting point!

BTW: This layout is much better than the .NET Gadgeteer Ultimate Guide".

Gus,

I just had a look at the Beginner’s Guide, and it is still 100 pages long and labelled as Rev 1.00.
It doesn’t seem to be different than the previous version.

@ jasdev -

For me, the link above opens a PDF that has a title of :

Beginners Guide to
C# and the .NET Micro Framework
January 20th 2012
Rev 2.0

Sorry :-[
It was a browser caching issue.

This looks just fine. It’s simple, it’s short, it’s what we need.
Thanks :slight_smile:

I actually like both versions, they just have a different use.

This new one is good for reading as an introduction while I think the old one is better as a reference where you don’t want to browse the web for every new thing you are trying to do.

Either way great job on those books!

I am learning using the FEZ spider. The LED example doesn’t work “better” with this line:

LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, true);

because FEZ_Pin is not recognised “using” any of the GHI namespaces, whether referenced or not.

Instead I got the diode blinking on a button attached to socket X with this line:

LED = new OutputPort((Cpu.Pin)5, true);

and with no references to GHI namespaces at all!

Incidentally, I can’t work out whether it is necessary to refer to namespaces by just “using” statements in the program.cs, or as references in Solution Explorer, or both. Can anybody tell me?

Are you using the Gadgeteer framework?

Both. You include the assembly name in references and the namespace with using in your code.

To elaborate a bit…when you reference an assembly (or DLL), you are telling Visual Studio to include it in your project, which is how a compiled assembly is made available.

The “using” directives are simply a convenience mechanism, which allow you to omit the fully-qualified namespace when you refer to members of that namespace.

In other words, the only thing that’s required in order to use some code from an assembly is to add a reference to that assembly. But if you do not add a using directive for the assembly’s namespace, your code would be a lot more verbose.

For example, in several projects I use GHI’s Glide UI library to create UI elements and forms. In order to use Glide, I have to reference the Glide assembly/DLL. Then, if I wanted to create a button, I could use code like this:

GHIElectronics.NETMF.Glide.UI.Button myButton = new GHIElectronics.NETMF.Glide.UI.Button();

That’s a lot of typing for one little button. By adding a using statement:

using GHIElectronics.NETMF.Glide.UI;

I can shorten my code to:

Button myButton = new Button();

Note that if you have multiple assemblies and using directives that have a class of the same name, you might have to still include the namespace in the code, but if that’s the case, the compiler will give you a heads up about the ambiguous reference(s).

You can use aliases in that case:

Suppose the classes Microsoft.Some.Very.Extra.Long.Assembly.Name.IO and GHIElectronics.Some.Very.Extra.Long.Assembly.Name.IO have both a Button class, then what you can do is:


using aliasM = Microsoft.Some.Very.Extra.Long.Assembly.Name.IO;
using aliasG =  GHIElectronics.Some.Very.Extra.Long.Assembly.Name.IO;

...

AliasM.Button myMButton = new AliasM.Button(...);
AliasG.Button myGButton = new AliasG.Button(...);


Thank you all for the excellent answers. Last time I programmed it was Fortran77 on a PDP16 so you may understand why I am a little behind the curve. I’ve only just realised what a monster the Spider is. I had been following Gus’s “beginners” book using console applications, hence the little difficulty. I was going to finish it before reading his new “ultimate guide”. I now realise that having jumped straight to the top of the tree like the monkey, I need to read backwards, so, yes, I am now using gadgeteer applications in Microsoft Visual C# Express. And thoroughly enjoying it.

[quote]LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, true);
because FEZ_Pin is not recognised “using” any of the GHI namespaces, whether referenced or not.
Instead I got the diode blinking on a button attached to socket X with this line:
LED = new OutputPort((Cpu.Pin)5, true);[/quote]

Hi, I’m also new to Gadgeteer/FEZ - hoping someone could give me some direction on this. I’m using the Spider and have the eblock extender and some modules - trying to get the piezo to work.

In the previously stated issue, what reference should be used for FEZ_Pin? I’m getting the same error. Or if it’s to be done a different way, are there some code samples?

What I found is (with FEZ_Pin having the issue):
public Piezo(FEZ_Pin.PWM pin)
{
pwm = new PWM((PWM.Pin)pin);
}

I see that FEZ_Pin is in the FEZmini_… reference, but that won’t work.

I apologize if this is a dumb question. I’m reading a couple of the beginner guides and searching for answers, but not quite finding the answers.

Thanks.

@ jspy66 - please post this in a new topic.

@ jspy66

This project will show you exactly how to drive eblock Piezos from a FEZ Spider:

http://code.tinyclr.com/project/407/gadgeteer-sounds-using-eblock-piezos/

Important note…sounds like you’re not using the Gadgeteer project template. If you didn’t see a design surface with the mainboard when you first started the project, then you probably have the wrong template, and you’ll be making your life a bit harder in the process.

Start with the Gadgeteer Application project template, and then use the code in the above post as a reference, and you should be making sounds in no time flat (note that while I use eblock pots for changing the tones, there’s also some commented out code that uses a timer if you don’t have the pots).

I reposted this under “GADGETEER - USING EBLOCK PIEZO”

I’ll post comments/questions there.

Thanks Devhammer, can’t wait to check out your code, and figure out where I went wrong.