Package com.tinkerforge
Class BrickletSegmentDisplay4x7
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletSegmentDisplay4x7
-
public class BrickletSegmentDisplay4x7 extends Device
Four 7-segment displays with switchable colon
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BrickletSegmentDisplay4x7.CounterFinishedListener
This listener is triggered when the counter (seestartCounter(short, short, short, long)
) is finished.class
BrickletSegmentDisplay4x7.Segments
-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEVICE_DISPLAY_NAME
static int
DEVICE_IDENTIFIER
static byte
FUNCTION_GET_COUNTER_VALUE
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_GET_SEGMENTS
static byte
FUNCTION_SET_SEGMENTS
static byte
FUNCTION_START_COUNTER
-
Constructor Summary
Constructors Constructor Description BrickletSegmentDisplay4x7(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCounterFinishedListener(BrickletSegmentDisplay4x7.CounterFinishedListener listener)
Adds a CounterFinished listener.int
getCounterValue()
Returns the counter value that is currently shown on the display.Device.Identity
getIdentity()
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.BrickletSegmentDisplay4x7.Segments
getSegments()
Returns the segment, brightness and color data as set bysetSegments(short[], short, boolean)
.void
removeCounterFinishedListener(BrickletSegmentDisplay4x7.CounterFinishedListener listener)
Removes a CounterFinished listener.void
setSegments(short[] segments, short brightness, boolean colon)
The 7-segment display can be set with bitmaps.void
startCounter(short valueFrom, short valueTo, short increment, long length)
Starts a counter with the *from* value that counts to the *to* value with the each step incremented by *increment*.-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_SET_SEGMENTS
public static final byte FUNCTION_SET_SEGMENTS
- See Also:
- Constant Field Values
-
FUNCTION_GET_SEGMENTS
public static final byte FUNCTION_GET_SEGMENTS
- See Also:
- Constant Field Values
-
FUNCTION_START_COUNTER
public static final byte FUNCTION_START_COUNTER
- See Also:
- Constant Field Values
-
FUNCTION_GET_COUNTER_VALUE
public static final byte FUNCTION_GET_COUNTER_VALUE
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletSegmentDisplay4x7
public BrickletSegmentDisplay4x7(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
setSegments
public void setSegments(short[] segments, short brightness, boolean colon) throws TinkerforgeException
The 7-segment display can be set with bitmaps. Every bit controls one segment: .. image:: /Images/Bricklets/bricklet_segment_display_4x7_bit_order.png :scale: 100 % :alt: Bit order of one segment :align: center For example to set a "5" you would want to activate segments 0, 2, 3, 5 and 6. This is represented by the number 0b01101101 = 0x6d = 109. The brightness can be set between 0 (dark) and 7 (bright). The colon parameter turns the colon of the display on or off.- Throws:
TinkerforgeException
-
getSegments
public BrickletSegmentDisplay4x7.Segments getSegments() throws TinkerforgeException
Returns the segment, brightness and color data as set bysetSegments(short[], short, boolean)
.- Throws:
TinkerforgeException
-
startCounter
public void startCounter(short valueFrom, short valueTo, short increment, long length) throws TinkerforgeException
Starts a counter with the *from* value that counts to the *to* value with the each step incremented by *increment*. *length* is the pause between each increment. Example: If you set *from* to 0, *to* to 100, *increment* to 1 and *length* to 1000, a counter that goes from 0 to 100 with one second pause between each increment will be started. Using a negative increment allows to count backwards. You can stop the counter at every time by callingsetSegments(short[], short, boolean)
.- Throws:
TinkerforgeException
-
getCounterValue
public int getCounterValue() throws TinkerforgeException
Returns the counter value that is currently shown on the display. If there is no counter running a 0 will be returned.- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'. The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addCounterFinishedListener
public void addCounterFinishedListener(BrickletSegmentDisplay4x7.CounterFinishedListener listener)
Adds a CounterFinished listener.
-
removeCounterFinishedListener
public void removeCounterFinishedListener(BrickletSegmentDisplay4x7.CounterFinishedListener listener)
Removes a CounterFinished listener.
-
-