// apa soccer game layout on shirt , HCr as boss off myself
#include <Bounce.h>
float movement = 0; // original = 0
float brightness = 32; // original 64
float size = 20; // original 10
float worldWidth = 60; //original 40
float worldHeight = 60; // original 40
int ledFactor = 3; // original 3
int minShade = -1;
int maxShade = 1;
#define DATA_PIN (3)
#define CLOCK_PIN (4)
#define LIGHT_COUNT (280)
#define pinModeFast(x, y) pinMode(x, y)
#define digitalWriteFast(x, y) digitalWrite(x, y)
uint32_t pixels[LIGHT_COUNT];
const int buttonPin_L = 14; // the pin that the pushbutton is attached to
const int buttonPin_R = 15;
int buttonPushCounter_L = 0; // counter for the number of button presses
int buttonState_L = 0; // current state of the button
int lastButtonState_L = 0; // previous state of the button
int buttonPushCounter_R = 0; // counter for the number of button presses
int buttonState_R = 0; // current state of the button
int lastButtonState_R = 0;
void setup() {
pinModeFast(DATA_PIN, OUTPUT);
pinModeFast(CLOCK_PIN, OUTPUT);
digitalWriteFast(DATA_PIN, LOW);
digitalWriteFast(CLOCK_PIN, LOW);
movement = random(0,10); //randomize start pattern start 0.2
// initialize the button pin as a input:
pinMode(buttonPin_L, INPUT);
pinMode(buttonPin_R, INPUT);
Serial.begin(9600);
}
static void set_pixel(uint32_t index, uint32_t color) {
pixels[index] = color & 0x1fffffff;
}
static void set_pixel_rgb(uint32_t index, uint32_t r, uint32_t g, uint32_t b) {
set_pixel(index, r | (g << 8) | (b << 16));
}
static void toggle_clock() {
digitalWriteFast(CLOCK_PIN, HIGH);
digitalWriteFast(CLOCK_PIN, LOW);
}
static void write_pixel(uint32_t i) {
const uint32_t MASK = ((uint32_t)(1) << 31);
uint32_t p = pixels[i] | MASK;
int j = 32;
while (j–) {
digitalWriteFast(DATA_PIN, (p & MASK) ? HIGH : LOW);
toggle_clock();
p <<= 1;
}
}
static void write_blank_pixel() {
int j = 31;
while (j–) {
digitalWriteFast(DATA_PIN, 0);