BBR Digital Expander Documentation

Example videos#

Short clips of a real board doing the thing the guides describe. Some behaviour is much easier to believe once you have watched it happen — especially the parts where the board acts without your code in the loop.

Latching a colour trigger#

BBR Expander Latching Example — a colour trigger in LATCHED mode holding a digital output high after the colour has gone.

A sensor port is taught a colour and a digital output is set to LATCHED mode, so the output goes high the moment that colour is seen and stays high after the colour has passed. The pin is only cleared when the code asks for it with clearOutputLatch().

That is the difference worth watching for: the colour is present for a fraction of a second, far too briefly for a loop to be guaranteed to catch it, and the output still comes on and stays on. See Latching for the code.

Latching a plain digital sensor#

BBR Digital Expander Latching — Digital Sensor: a high/low sensor on an encoder port latching a digital output.

The sensor here is not a colour or distance sensor on a sensor port — it is an ordinary digital sensor whose output is simply high or low, plugged into an encoder port’s A line, latching a digital output when it changes state.

Worth knowing before you copy it: the board has no digital-input trigger source. An output can watch a sensor class, an encoder count or the IMU heading, and that is the list. What makes this work is that with the B line left unconnected and idle, the quadrature decoder stops accumulating and its count simply follows A’s level — so an ordinary encoder-count trigger becomes a digital-input trigger, and LATCHED mode works on it like anything else.

Two things that catch people out:

  • Which count means “triggered” is not fixed. It depends on the level the input happened to be at when the channel was last reset, so read the count in both states once and set the window from what you see, rather than assuming it is 1.
  • The B line must sit still. Anything driving B turns the count back into a real quadrature count and the trigger stops meaning anything.

A native digital-input source would remove both caveats, and is on the list.