DigitalIn gets values from from the digital input ports of a device (where an on/off sensor is attached), and allows the user to process those values before sending them to the next widget. By default, the range of values is 0-1023. But by changing the min and max values in the widget, the sensor values can be scaled to a different range.
The values can also be inverted (e.g. 1023-0), smoothed out to get rid of noise in the values, and given easing to make changes in values seem to have momentum and be more natural.
Even before you connect your hardware, you can simulate a sensor by moving the round visual “knob” on-screen. This way, you can see what happens to other widgets when they get values from the sensor.
Set the device port (e.g. D12) on the left to select a physical port on the device. Connect the right hand output of the widget to another widget.
Often the values coming from a sensor will not match what the rest of your project needs. So you may need to “condition” the sensor values.
- Output range min and max – These allow you to scale the incoming values to start at min and end at max. For example, typically sensor values range from 0-1023. Changing max to 500 would scale those values to have a range of 0-500.
- Invert – Invert reverses the values so that an incoming value of 0 is the max value, and 1023 is the min value.
- Smooth – Conditions the values coming in to eliminate a jittery signal coming from the sensor.
- Ease – Gives the values a natural feeling sense of momentum.
Additional adjustments can be made in the “more” section of the widget. Click on the more tab, and you will see:
- Input range min and max – these allow you to change the values that are scaled to the output min and max you set on the widget. For example, if the useful values coming from the sensor started at 300 and went to 600, you could set the input range min/max to those values, and they would then be scaled to 0-1023 (if that’s what the widget min/max were set to).
- Ease amount – this sets the amount of easing that’s applied to the input values. A higher number is more easing, and slows down the rate of change of values.
- Smooth amount – this sets the amount of smoothing and increases the stability of the values. It also slows down the rate of change.