def queued(values, qsize):
    """
    Queues up readings from *values* (the number of readings queued is
    determined by *qsize*) and begins yielding values only when the queue is
    full. For example, to "cascade" values along a sequence of LEDs::

        from gpiozero import LEDBoard, Button
        from gpiozero.tools import queued
        from signal import pause

        leds = LEDBoard(5, 6, 13, 19, 26)
        btn = Button(17)

        for i in range(4):
            leds[i].source = queued(leds[i + 1], 5)
            leds[i].source_delay = 0.01

        leds[4].source = btn

        pause()
    """
    values = [_normalize(v) for v in values]
    if qsize < 1:
        raise ValueError("qsize must be 1 or larger")
    q = []
    it = iter(values)
    try:
        for i in range(qsize):
            q.append(next(it))
        for i in cycle(range(qsize)):
            yield q[i]
            q[i] = next(it)
    except StopIteration:
        pass
Queues up readings from *values* (the number of readings queued is
    determined by *qsize*) and begins yielding values only when the queue is
    full. For example, to "cascade" values along a sequence of LEDs::

        from gpiozero import LEDBoard, Button
        from gpiozero.tools import queued
        from signal import pause

        leds = LEDBoard(5, 6, 13, 19, 26)
        btn = Button(17)

        for i in range(4):
            leds[i].source = queued(leds[i + 1], 5)
            leds[i].source_delay = 0.01

        leds[4].source = btn

        pause()