Hi typcs,
Welcome to the community! I loved the Getting Started with Netduino book, and it really gave me a good primer and helped me as someone who had little prior knowledge of microcontrollers and the C# language. Since the book's publication there have been several changes to the .Net Micro Framework, and as a result some of the sections in the book require slight modifications in order for the samples to work. The samples use the Secret Labs AnalogInput and PWM classes, and since the books release, Microsoft has added new PWM and AnalaoInput classes to NETMF 4.2. The good news is that the code will still work but you need to strictly define the classes namespace to avoid conflict with the MS classes.
To do so you will need to add the SecretLabs.NETMF.Hardware.AnalogInput assembly file to your project. To do this you simply:
- Right click on "Reference" in the Solution Explorer within Visual Studio, generally located to the far right of your screen.
- Select "Add Reference"
- In the .Net Applications tab find and add the SecretLabs.NETMF.Hardware.AnalogInput assembly file.
Now in your code you need to make sure you fully define the namespace and class name like so:
SecretLabs.NETMF.Hardware.AnalogInput pot = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);
After doing this, your project should run perfectly. Once you have mastered the samples in the book you can try the Microsoft's AnalogInput and PWM classes, which you will see used often in more recent code samples. They have slightly different constructors, and accept different arguments when you create a new instance of them. There are a few examples found in our forums when you're ready to give it a shot.
Happy hacking and if you have any other questions feel free to post them here in the forum.
Cheers,
Steve