Home > Reference > Widgets > Input-Output > DigitalOut

DigitalOut

The DigitalOut widget controls the digital output ports on a microcontroller, turning them on or off. These ports are typically used to control LEDS, relays (to control high power devices such as 110 volt lights) or motors. The DigitalOut widget turns the digital output port on within a defined range of inputSource values, as set by the from and to settings. So for example, if an AnalogIn was monitoring a knob (potentiometer) used to sense how far a door was open, and the “open” position ranged from 500-700, the DigitalOut could turn on an LED in that position by setting its from to 500 and the to setting to 700.

On Screen Features

  • IN:Shows the values coming from the inputSource as well as the instance name of the inputSource
  • OUT: Shows the output value visually, either on or off. Also shows the type of controller, and the digital output port on the controller. You can click on the circle icon to manually to turn the power on or off.
  • CONNECT: Establishes a connection with the microcontroller

Parameters

  • CONTROLLER: Determines which kind of controller the widget communicates with, Arduino, XBee (new!), or Make
  • CONTROLLERIP: Sets the IP address used to communicate with the Make Controller
  • CONTROLLER OUTPUT: The digital output port on the microcontroller
  • CONTROLLERPORT: Sets the IP Port used to communicate with the Make Controller in combination with the CONTROLLER IP. By default this is 10000.
  • INPUT SOURCE: The instance name of the source the widget listens to, e.g AnalogInput or DigitalInput
  • INVISIBLE: If set to “yes”, the widget will disappear when the Flash movie is run
  • REMOTE HUB IP: This sets the IP address of the Hub where the widget will send values to a microcontroller. Normally this would be 127.0.0.1 for the Hub running locally. But if you want to send values to 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 a microcontroller on a remote computer with outputs 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.
  • 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.usbserial*) 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.
  • THRESHOLD: If the input value is equal to or greater than this number (500 by default) then the widget will turn on the output port on the microcontroller.

Code Interface

digitalOutInstance.sendOutput(value, port);

The sendOutput function allows code to send out arbitrary values to any port on the microcontroller.


Last modified March 26th, 2011