DigitalIn
The DigitalIn widget connects to digital inputs on the microcontroller and provides some processing of the sensor values as they come in. The default range for digital inputs 0 – 1, but this range is scaled by DigitalIn to any range desired by setting the min and max numbers. DigitalIn also has a button which allows the user to simulate the values of a sensor coming in, so the user can test other parts of their application with no external hardware hooked up.
For instructions on how to wire a switch for use with a microcontroller, see this page.
On Screen Features
- CONNECT: When on, reads data from the sensor at the selected port. When off, use the slider to set the value. The off mode is useful for when you don’t have the sensor and/or microcontroller hooked up, but still want to test what would happen. You can simulate the operation of the sensor clicking on the IN button.
- IN: A button display of the unprocessed data coming from the sensor. This can also be clicked on to simulate a hardware on or off when the widget is not connected.
- MAX: Sets the highest value output. The highest raw value is scaled to this value
- MIN: Sets the lowest value output. The lowest raw value is scaled to this value
- SMOOTH: When on, performs a median filter on the raw sensor readings so that the processed values are less jittery. This is helpful because many sensors produce rough readings that change more than you want.
- INVERT: Makes a high raw value produce a low output value and visa versa. Useful for reversing the effect of a sensor
- OUT: The value output by the widget after all processing is applied
Parameters
- CONTROLLER: Determines which kind of controller the widget communicates with, Arduino, Make, OSC, Xbee, or an inputSource (inputSource means that the widget will get input from another widget with the name set in the INPUTSOURCE parameter.
- CONTROLLERINPUTNUM: Sets the analog input port on the controller – starts at 0 to use the first port on the controller. For the Arduino, use ports starting at 2 and above. When using an inputSource such as OSC that may have multiple values, this number sets the argument used. E.g. in /acceleration/xyz 0.1 0.2 0.3, setting controllerInputNum to 2 would get the third argument for the Z value of 0.3.
- CONTROLLERIP: Sets the IP address used to communicate with the Make Controller, or Osculator. NOTE: The default controllerIP address used for the Make is 192.168.0.200. This works with the older, larger Make Controller. For the newer, smaller Make Controller, the default address on the Make seems to be 192.168.0.201. So if you find AnalogInput is not communicating with the Make Controller, try setting the controllerIP to 192.168.0.201.
- CONTROLLERPORT: Sets the IP Port used to communicate with the Make Controller in combination with the CONTROLLER IP. By default this is 10000.
- INPUTSOURCE: Used if “inputSource” is selected in the CONTROLLER parameter. In this case, the values processed by AnalogInput will come from another widget with the name specified in inputSource.
- INVISIBLE: if set to “yes”, the widget will disappear when the Flash movie is run - NOTE: you can make all the widgets invisible interactively when the Flash moving is running simply by pressing the backslash key “\”.
- OSC MULTIPLIER: Used when the controller is set to OSC. Many OSC devices and software provide fractional values from 0-1. To work with other toolkit widgets, these numbers should be scaled up to an integer range. By setting oscMultipler, any number sent by the OSC source will be multiplied by this number.
- OSC STRING: This is the OSC message that DigitalIn will listen for. For example “/slider/1″ will listen for the message from iPhone app OSCemote’s first slider.
- REMOTE HUB IP: This sets the IP address of the Hub where the widget will get input values from a microcontroller. Normally this would be 127.0.0.1 for the Hub running locally. But if you want to receive values from a Hub and microcontroller running on a remote computer, change this IP to the address of the remote computer. In this way, widgets on multiple computers can access sensor data from a remote computer with sensors attached. Note that even if you are using a remote Hub, the Hub application must also be running locally on the same machine as the widgets.
- SAMPLERATE: Sets the number of times per second the microcontroller port is queried for its value. In some cases, reducing this make improve performance.
- SERIALPORT: For widgets set to communicate with an Arduino or XBee, the USB serial port name that the device is connected to. On the Mac, you can leave the default (/dev/cu.usb*) if only one device is hooked up. On the PC, replace this with the COM port used, e.g. COM7. For more detailed info on how to set this parameter, see the common features for all widgets discussion here.
- SMOOTHING BUFFER SIZE: Sets the size of the buffer for the smoothing. the larger the number, the more smooth the processed values will be. but the other effect is that the processed values will have a lag time from the actual sensor data. This lag time will increase with the buffer size.
- XBEEREMOTEID: When using the Xbees, use this number to indicate which remote Xbee you wish to communicate with. (note, this is a decimal number, when configureing the XBee in XCTU the ID number you enter there is in hexedecimal).
Using OSC
The DigitalIn works with OSC, where any input value that equals 1 or great will be considered ON, and anything below 1 will be consider OFF. For more info on working with OSC, see the OSC tutorial page.
Last modified October 28th, 2011

