Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Getting Started with Netduino 2

Netduino 2 Getting Started

  • Please log in to reply
7 replies to this topic

#1 ricafort

ricafort

    New Member

  • Members
  • Pip
  • 5 posts

Posted 09 March 2013 - 04:23 AM

Hi everyone. I am new to netduino and just recently bought a netduino 2. I am following the examples to "Making Music from the Getting Started with netduino but I cannot make it run using the code from the book. Please help!!!. thanks.
 
Also there are more examples that wont run from the book using netduino 2


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 09 March 2013 - 10:46 AM

Hi ricafort, Netduino 2 should work with almost all Netduino 1 samples, but you'll need to do 2 quick things if you're using the AnalogInput or PWM features. If you're using AnalogInput, add the SecretLabs.NETMF.Hardware.AnalogInput.dll assembly as a reference to your project. If you're using PWM, add the SecretLabs.NETMF.Hardware.PWM.dll assembly as a reference to your project. Then when you create your object, be sure to specify the full class name including namespace. For example:
SecretLabs.NETMF.Hardware.AnalogInput analogInput = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);
We'll be updating the book samples online soon so that you don't need to do the modifications yourself. Does that get you up and running? Chris

#3 ricafort

ricafort

    New Member

  • Members
  • Pip
  • 5 posts

Posted 13 March 2013 - 12:56 AM

Thanks very much Chris. I will try them out and will update this post :)



#4 ricafort

ricafort

    New Member

  • Members
  • Pip
  • 5 posts

Posted 13 March 2013 - 11:02 AM

Thanks very much, I finally made it working by following your advise:

 

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]"If you're using AnalogInput, add the SecretLabs.NETMF.Hardware.AnalogInput.dll assembly as a reference to your project. If you're using PWM, add the SecretLabs.NETMF.Hardware.PWM.dll assembly as a reference to your project."[/color]



#5 sebswed

sebswed

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSweden

Posted 07 April 2013 - 08:56 AM

Hello Chris (or other expert).

 

First time netduino user here. I have very little programming experience and none in C (installed Visual C# 2010 express yesterday - never used before).

 

I know more about hardware than software so I'm just doing basic coding and I too follow the example in your book. Could you provide me with the code for "[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]If you're using PWM, add the SecretLabs.NETMF.Hardware.PWM.dll assembly as a reference to your project.[/color]" (as I'm using i/o 5 wich from what I understand is the PWM port). Also, on which line should I paste this .dll reference to make it work (under the "using SecretLabs.NETMF.Hardware.Netduino;" ? )

 

Thanks in advance!


Netduino Plus 2 (v4.2.2.2)


#6 sebswed

sebswed

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSweden

Posted 07 April 2013 - 07:08 PM

Ok I found the code:

SecretLabs.NETMF.Hardware.PWM pwm = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D5);

 

I will experiment with this tomorrow.


Netduino Plus 2 (v4.2.2.2)


#7 cutlass

cutlass

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationNew England. :)

Posted 07 April 2013 - 07:36 PM

I know more about hardware than software so I'm just doing basic coding and I too follow the example in your book.

 

Neat, another hardware geek!

We are taking over! ;)

 

You may want to check out my example, and project that you can download, that I listed at:

http://forums.netdui...etduino-plus-2/

 

I write in the more familiar "C" "K&N"-style. :)

For one thing, I have a better feeling on how it compiles. :)  For a Framework, like the .NET Framework, it gets harder to determine, because it gets compiled into intermediate code.

Note: Using "C" and the style does not mean that the code gets compiled to assembler for the Netduino (or under C#).  It still gets compiled into Common Intermediate Language (CIL) code.

 

I haven't bothered to determine what really happens in assembler instructions, with code that is done like below:
 

if (i < 10) {   tmp = new int;   tmp = 0;   if (j++ < 100) {      tmp = j + i;      k = tmp + tmp;   }}

 

With the "tmp = new int" statement, are any additional assembler instructions executed when it comes into or goes out of scope?  Or, does the compiler allocate space on the stack at the start of the procedure, and just flag any incorrect references to "tmp" as errors?

There are also many more cases.

 

FWIW, I used YACC in Grad school to get a C-compiler for our/my Z8000 system that I was using.  I taught C and assembler to undergrads.  And, I've done (too much :)) optimization of assembler code over the years.



#8 sebswed

sebswed

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSweden

Posted 07 April 2013 - 08:20 PM

Helllo Cutlass.

 

Thank you for the link to your post. Now I know how to add the refference and how to read analog input data!

It all makes sense now :-)


Netduino Plus 2 (v4.2.2.2)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.