; ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. ; ; SPDX-License-Identifier: BSD-3-Clause ; ; SET pin 0 should be mapped to your LED GPIO .program blink pull block out y, 32 .wrap_target mov x, y set pins, 1 ; Turn LED on lp1: jmp x-- lp1 ; Delay for (x + 1) cycles, x is a 32 bit number mov x, y set pins, 0 ; Turn LED off lp2: jmp x-- lp2 ; Delay for the same number of cycles again .wrap ; Blink forever! % c-sdk { // this is a raw helper function for use by the user which sets up the GPIO output, and configures the SM to output on a particular pin void blink_program_init(PIO pio, uint sm, uint offset, uint pin) { pio_gpio_init(pio, pin); pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); pio_sm_config c = blink_program_get_default_config(offset); sm_config_set_set_pins(&c, pin, 1); pio_sm_init(pio, sm, offset, &c); } %}