Dimmer - DCS-Skunkworks/dcs-bios-arduino-library GitHub Wiki
Class Name
Dimmer
Description
Drive an analog pin from a DCS ranged value. Traditionally used for a dimmable LED or bulb. Reminder that most microcontrollers use PWM to achieve dimming analog outputs and this may or may not be compatible with your connected device.
Constructor 1
Dimmer(unsigned int address, char pin, int minOutput=0, int maxOutput=255)
- address - The DCS address of the value to sync to.
- pin - The analog output pin to be controlled.
- minOutput - [Optional] Used to limit the output range. Defaults to zero (always/full OFF) to map the minimum DCS value to.
- maxOutput - [Optional] Defaults to 255 (always/full ON) to map the maximum DCS value to. Do not exceed 255.
Constructor 2
Dimmer(unsigned int address, char pin, unsigned int (*map_function)(unsigned int newValue))
- address - The DCS address of the value to sync to.
- pin - The analog output pin to be controlled.
- map_function - A custom function which can be used to provide arbitrary (nonlinear, conditional, etc) mappings between DCS values and output pin values.
Example 1
DcsBios::Dimmer apuRpm(0x10BE, A0); // The brightness of an LED on pin A0 will correspond to the position of RPM of the APU.
Example 2
DcsBios::Dimmer lEngCore(0x10A8, A1, 64, 191); // The brightness of an LED on pin A1 will correspond to the position of LENG Core RPM, restricted to the middle 50% of the LED's brightness range