.program oscillate pause: pull block out x,32 .wrap_target pull noblock out x, 32 mov y, x set pins, 1 ; Pin ON jmp y-- lp1 ; Delay for (x + 1) cycles, x is a 32 bit number jmp pause lp1: jmp y-- lp1 ; Delay for (x + 1) cycles, x is a 32 bit number mov y, x set pins, 0 [2] ; Pin OFF lp2: jmp y-- 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 oscillate_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 = oscillate_program_get_default_config(offset); sm_config_set_set_pins(&c, pin, 1); pio_sm_init(pio, sm, offset, &c); } %}