-18.35%

Netduino Go - Potentiometer Module

Netduino Go! - Potentiometer Module
SKU: P00000315

2 pcs. available from stock

Regular Price: CHF10.90

Special Price CHF8.90

.

Fast shipping from our own warehouse in Steinhausen/ZG. Free delivery for orders starting from CHF 300.00!

Products can also be picked up.

Questions or suggestions? Contact us.

Product Description
Details

Netduino Go! - Potentiometer Module

Sample Code:

using Microsoft.SPOT;
namespace Module_Tests
{
    public class Program
    {
        public static void Main()
        {
            NetduinoGo.RgbLed led = new NetduinoGo.RgbLed();
            NetduinoGo.Potentiometer pot = new NetduinoGo.Potentiometer();

            // pot.GetValue() - Returns a float from 0 to 1. 

            while (true)
            {
                led.SetColor(0, 0, (byte)(pot.GetValue() * 255));
            }
        }
    }
}


Code with method to set a custom range:

using Microsoft.SPOT;
namespace Module_Tests
{
    public class Program
    {
        public static void Main()
        {
            NetduinoGo.RgbLed led = new NetduinoGo.RgbLed();
            NetduinoGo.Potentiometer pot = new NetduinoGo.Potentiometer();

            while (true)
            {
                led.SetColor(0, 0, (byte)(Map(pot.GetValue(), 0, 1, 0, 255)));
            }
        }

        // Used for mapping range of values to another range, linearly.
        public static float Map(float input, float inMin, float inMax, float outMin, float outMax)
        {
            return ((input - inMin) * (outMax - outMin) / (inMax - inMin) + outMin);
        }
    }
}


 

Additional Information
Additional Information
SKU P00000315
Weight 0.0100
Manufacturer Secret Labs LLC
Reviews
Write Your Own Review

Only registered users can write reviews. Please, log in or register

Questions or Suggestions?

Do you have a question about a product? Do you have a suggestion for the description or even found an error? Contact us!