led_bikewheel/led_test/led_test.ino

51 lines
866 B
Arduino
Raw Normal View History

2020-12-29 22:02:51 +01:00
#include <FastGPIO.h>
#define APA102_USE_FAST_GPIO
#include <APA102.h>
// Define which pins to use.
2020-12-30 22:59:56 +01:00
const uint8_t dataPin = 3;
const uint8_t clockPin = 2;
2020-12-29 22:37:27 +01:00
const uint8_t brightness = 1;
2020-12-29 22:02:51 +01:00
const uint16_t led_count = 112;
2020-12-29 22:37:27 +01:00
rgb_color color_buffer[led_count];
2020-12-29 22:02:51 +01:00
// Create an object for writing to the LED strip.
APA102<dataPin, clockPin> ledStrip;
void setup()
{
}
void loop()
{
for (int i = 0; i < led_count; i++)
{
color_buffer[i] = rgb_color(255, 0, 0);
}
ledStrip.write(color_buffer, led_count, brightness);
delay(1000);
for (int i = 0; i < led_count; i++)
{
color_buffer[i] = rgb_color(0, 255, 0);
}
ledStrip.write(color_buffer, led_count, brightness);
delay(1000);
for (int i = 0; i < led_count; i++)
{
color_buffer[i] = rgb_color(0, 0, 255);
}
ledStrip.write(color_buffer, led_count, brightness);
delay(1000);
}