diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index bee77238b5..9e8d5feebc 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -436,7 +436,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, if (first_in_pin == NULL) { mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d waits based on pin"), i); } - if (wait_index > in_pin_count) { + if (wait_index >= in_pin_count) { mp_raise_ValueError_varg(translate("Instruction %d waits on input outside of count"), i); } }