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

    Class Switch<L>

    A two-state output over any line, with its polarity said once: a relay, an LED, a solenoid valve, a buzzer. set(true) asserts it, which drives the line low for an active-low part, so no call site inverts a level by hand.

    const pump = Switch.activeLow(new PinScript())
    pump.set(true)
    pump.isAsserted // true, and the line was driven low

    Type Parameters

    Index
    • get isAsserted(): boolean

      Whether the part was last set on.

      Returns boolean

    • get polarity(): PinPolarity

      How the part is wired.

      Returns PinPolarity

    • Hands the line back, for a test to read what was driven or a program to reuse it.

      Returns L

      The line.

    • Turns the part on or off, driving whichever level that means for its wiring.

      Parameters

      • asserted: boolean

        true to turn it on.

      Returns void

      Whatever the line throws when it cannot be driven.

    • A switch whose part is asserted by a high level.

      Type Parameters

      Parameters

      • line: L

        The line the part is wired to.

      Returns gpio.Switch<L>

      The switch.

    • A switch whose part is asserted by a low level, the wiring of most relay boards.

      Type Parameters

      Parameters

      • line: L

        The line the part is wired to.

      Returns gpio.Switch<L>

      The switch.