Joystick

Library: Input/Output
Introduced: 2.2.0
Appearance:

Behavior

The user can drag the red knob within the rounded-square area, and the outputs update to indicate the knob's current x- and y-coordinates. This is meant to emulate the joysticks known from the days of classical arcade games.

Pins

West edge, north pin (output, bit width matches Bit Width attribute)
Indicates knob's x-coordinate, to be interpreted as an unsigned integer whose value will never be 0. Thus, a value of 1 represents the far left, and the maximum value for the bit width indicates the far right. When the knob is at rest (in the center), the value has the bit pattern 10...00.
West edge, south pin (output, bit width matches Bit Width attribute)
Indicates knob's y-coordinate, whose value ranges as with the x-coordinate pin. When the knob is pulled to the top, this output's value is 1, and when the knob is pulled to the bottom, the output is the maximum value for the bit width selected.

Attributes

When the component is selected or being added, Alt-2 through Alt-5 alter its Bit Width attribute.

Bit Width
The number of bits used to indicate each of the knob's coordinates.
Color
The knob's color as it is drawn on the screen.

Poke Tool Behavior

Pressing the mouse button while within the joystick area moves the knob to that location and updates the outputs. Dragging the mouse continues to move the knob and update the outputs, keeping the knob within the joystick's area. Releasing the mouse button reverts the knob back to its rest position.

Text Tool Behavior

None.

Back to Library Reference