Class MindSensorsNumPad

    • Constructor Detail

      • MindSensorsNumPad

        public MindSensorsNumPad​(I2CPort port)
        Constructor for objects of the NumericPad of Mindsensors. It assumes that you didn't change the I??C address of the device.
        Parameters:
        port - the port number (SensorPort.S1 ... SensorPort.S4) to which the numeric pad is connected.
      • MindSensorsNumPad

        public MindSensorsNumPad​(Port port)
        Constructor for objects of the NumericPad of Mindsensors. It assumes that you didn't change the I??C address of the device.
        Parameters:
        port - the port number (SensorPort.S1 ... SensorPort.S4) to which the numeric pad is connected.
    • Method Detail

      • init

        protected void init()
      • readButtons

        public int readButtons()
        Returns a Bitmask. Bits 0 to 9 correspond to the Number Keys 0 to 9. Bit 10 corresponds to the star and Bit 11 to the hash key.
        Returns:
        the bitmask, or ERROR if an I2C error has occured
      • discardEvents

        public void discardEvents()
        This method discards any events.
      • waitForAnyEvent

        public int waitForAnyEvent()
        Waits for some button to be pressed or released. Which buttons have been released or pressed is returned as a bitmask. The lower twenve bits (bits 0 to 11) indicate, which buttons have been pressed. Bits 16 to 27 indicate which buttons have been released.
        Returns:
        the bitmask
      • waitForAnyEvent

        public int waitForAnyEvent​(int timeout)
        Waits for some button to be pressed or released. Which buttons have been released or pressed is returned as a bitmask. The lower twenve bits (bits 0 to 11) indicate, which buttons have been pressed. Bits 16 to 27 indicate which buttons have been released.
        Parameters:
        timeout - The maximum number of milliseconds to wait
        Returns:
        the bitmask
      • waitForAnyPress

        public int waitForAnyPress()
        Waits for some button to be pressed. If a button is already pressed, it must be released and pressed again.
        Returns:
        the ID of the button that has been pressed or in rare cases a bitmask of button IDs
      • waitForAnyPress

        public int waitForAnyPress​(int timeout)
        Waits for some button to be pressed. If a button is already pressed, it must be released and pressed again.
        Parameters:
        timeout - The maximum number of milliseconds to wait
        Returns:
        the ID of the button that has been pressed or in rare cases a bitmask of button IDs, 0 if the given timeout is reached
      • maskToString

        public static java.lang.String maskToString​(int x)
        The lower 12 bits (Bits 0 to 11) are converted to a string containing 0 to 9, *, and # depending on whether which of bits are set. The returned string contains these character in that order.