-18.35%

Netduino Go - Potentiometer Module

Netduino Go! - Potentiometer Module
Artikelnummer: P00000315

2 Stk. ab eigenem Lager sofort lieferbar!

Regulärer Preis: CHF 10.90

Special Price CHF 8.90

Schneller Versand ab eigenem Lager in Steinhausen/ZG. Ab CHF 300.00 portofrei!

Produkte können auch abgeholt werden.

Fragen oden Anregungen? Kontakt.

Artikelbeschreibung
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);
        }
    }
}


 

Zusatzinformation
Zusatzinformation
Artikelnummer P00000315
Gewicht 0.0100
Hersteller Secret Labs LLC
Bewertungen
Schreiben Sie Ihre eigene Kundenmeinung

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

Fragen oder Anregungen?

Haben Sie eine Frage zum Produkt? Haben Sie eine Anregung zur Beschreibung oder sogar einen Fehler entdeckt? Kontaktieren Sie uns!