#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "pico/binary_info.h"
void setupLED(int LED_pin)
{
gpio_init(LED_pin);
gpio_set_dir(LED_pin, GPIO_OUT);
}
void ON_LED(int LED_pin)
{
gpio_put(LED_pin, 1);
}
void OFF_LED(int LED_pin)
{
gpio_put(LED_pin, 0);
}
void setupSPI()
{
spi_init(SPIO, 1000 * 1000);
gpio_set_function(4, GPIO_FUNC_SPI); // Clock pin
gpio_set_function(5, GPIO_FUNC_SPI); // Tx pin
gpio_set_function(6, GPIO_FUNC_SPI); // Rx pin
gpio_set_function(7, GPIO_FUNC_SPI); // Chip Select pin
bi_decl(bi_1pin_with_name( 7, "SPI CS"))
}
void SendSPI()
{
}
void ReadSPI()
{
}
int main()
{
stdio_init_all();
while (true) {
setupSPI();
setupLED(28);
printf("Light is turning on!\n");
ON_LED(28);
sleep_ms(500);
printf("Light is turning off!\n");
OFF_LED(28);
sleep_ms(500);
}
}