/**
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdio.h>
#include "pico/stdlib.h"
const uint LED_PINS[] = {2, 3, 4, 5, 6, 7, 8, 9};
const uint NUM_LEDS = sizeof(LED_PINS) / sizeof(LED_PINS[0]);
int main()
{
stdio_init_all();
for (uint i = 0; i < NUM_LEDS; i++) {
gpio_init(LED_PINS[i]);
gpio_set_dir(LED_PINS[i], GPIO_OUT);
}
while (true) {
for (uint i = 0; i < NUM_LEDS; i++) {
gpio_put(LED_PINS[i], 1);
sleep_ms(100);
gpio_put(LED_PINS[i], 0);
}
for (int i = NUM_LEDS - 2; i > 0; i--) {
gpio_put(LED_PINS[i], 1);
sleep_ms(100);
gpio_put(LED_PINS[i], 0);
}
}
return 0;
}