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.

Basset

Member Since 25 Nov 2012
Offline Last Active Aug 26 2014 05:36 AM
-----

#43226 New command for SetRange?

Posted by Basset on 12 January 2013 - 05:30 PM

Awesome, thanks for the help!  I got it all working now using the new firmware.  Here's the code that I used in case someone else has the same problem:

 

using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;//Make sure to add the 4.2.2 assemblies to your references if you're not on the 4.2.2 sdk.namespace Light_Pot{    public class Program    {        public static void Main()        {            // write your code here            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);            SecretLabs.NETMF.Hardware.AnalogInput pot = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);            pot.SetRange(100, 250);            int potValue = 0;            while (true)            {                potValue = pot.Read();                //read the value of the potentiometer                //blink the led based on the potentiometer's value                led.Write(true);                Thread.Sleep(potValue);                led.Write(false);                Thread.Sleep(potValue);            }        }    }}

 

 




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.