Secret Labs LLC Netduino Go Potentiometer Modules
VariousOnly 2 items in stock at supplier
Product 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);
}
}
}.
Compatible hardware | Various |
Item number | 5998855 |
Manufacturer | Secret Labs LLC |
Category | Electronics modules |
Manufacturer no. | P00000315 |
Release date | 29.8.2012 |
Compatible hardware | Various |
Module type | Various |
CO₂-Emission | |
Climate contribution |