pamoja for TypeScript - v0.2.0
    Preparing search index...

    Class Contact<L>

    A two-state input over any line, with its polarity said once: a button, a float switch, a reed switch, a limit switch. Contact.isAsserted answers whether it is closed, pressed, or tripped, whatever level that takes on the wire.

    const float = Contact.activeLow(new PinScript([PinLevel.Low]))
    float.isAsserted() // true: a switch to ground reads low when closed

    Type Parameters

    Index
    • get polarity(): PinPolarity

      How the part is wired.

      Returns PinPolarity

    • Reads the line and reports whether the part is asserted.

      Returns boolean

      Whether it is closed, pressed, or tripped.

      Whatever the line throws when it cannot be read.

    • Reads the raw level on the line.

      Returns PinLevel

      The level.

      Whatever the line throws when it cannot be read.

    • Hands the line back.

      Returns L

      The line.

    • A contact that reads high when asserted.

      Type Parameters

      Parameters

      • line: L

        The line the part is wired to.

      Returns gpio.Contact<L>

      The contact.

    • A contact that reads low when asserted, the wiring of a switch to ground with a pull-up.

      Type Parameters

      Parameters

      • line: L

        The line the part is wired to.

      Returns gpio.Contact<L>

      The contact.