Main Site Documentation

Code for Gadgeter from Forum & Namespaces


#1

This is very much a newbie question but in running some code I copied from the forum and also from 10rem - Pete Brown’'s Blog I had trouble creating executable files that had appropriate filenames and namespaces and ran into a variety of conflicts. Also some files wanted to be the “Setup” (wrong term)
but equivalent to code with a .cs extension similar to that generated by the Designer and other code wanted to be the running program on Gadgeteer. What in Newbie’s terms is the general procedure in copying code from the forum and creating a working Gadgeteer Project in Visual Studio Express?

–Ira


#2

I don’t think there is one bullet-proof way of doing this, but here are some pointers.

  1. Create solution in Visual Studio
  2. Copy code
  3. Resolve namespaces

#3

Do I understand that I insert the code from the forum to existing FIies (named what?) that I have created with Visual Studio? Is one file the one I generated with the designer and the other one that I created with some other template to manipulate the Gadgeter configuration and read values.

How should I name the previously created files; is there any “magic” I should do to avoid Namespace
conflicts or duplications?

Thanks
–Ira


#4

@ laefsky Welcome to the community!

Maybe if you pasted or pointed us to the code you’re trying to run we could give you more exact details. To extend upon what Architect mentioned, for a Gadgeteer project, you will typically want to do the following.

  1. In Visual Studio, create a new “Gadgeteer” project.
  2. In the designer, add the modules you need and place them on sockets (preferably the same ones the sample code used). Be sure and name your modules the same as the sample code.
  3. Copy your code to the Program.cs file. Note that this makes an assumption that you are using a very basic sample. Larger projects may require you to create multiple files.

Hopefully, this clears things up a little.


#5

Thank You Both:

This information on pasting andthe naming of files should get me started.

–Ira