#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/spi.h"
#include "hardware/gpio.h"
#include "hardware/timer.h"
int main() {
stdio_init_all();//I still have no clue what this function does
spi_init(spi0, 9600);//initiallizing SPI since I do not want to bit-bang
gpio_init(4);//latch pin
gpio_set_function(2,1);
gpio_set_function(3,1);
gpio_set_dir(4,1);//dir out
int n1 = 0b11111111; //default all out
int n2 = 0b10101010;
int n3 = 0b01010101;
int n = 1;
while (1){
gpio_put(4,0);
if (n%2 == 0) { //testing the parity of n
spi_write_blocking(spi0, &n2, 1); //lights on
} else {
spi_write_blocking(spi0, &n3, 1); //lights on
}
gpio_put(4,1);
n += 1;
sleep_ms(1000);
}
return 0;
}