/*
Arduino | general
|°ΉӨMΣ°| — 6/18/24 at 8:09 PM
is there any error? idk
*/
const unsigned long P_DELAY = 5000;
const int NUM_PINS = 4;
const int PATTERN_ROWS = 8;
const int PATTERN_COLS = NUM_PINS;
const int B_PINS[NUM_PINS] = {11, 10, 9, 8};
const bool PATTERNS[PATTERN_ROWS][PATTERN_COLS] = {
{HIGH, LOW, LOW, LOW},
{LOW, HIGH, LOW, LOW},
{LOW, LOW, HIGH, LOW},
{LOW, LOW, LOW, HIGH},
{HIGH, LOW, LOW, HIGH},
{LOW, HIGH, HIGH, LOW},
{HIGH, LOW, HIGH, LOW},
{LOW, HIGH, LOW, HIGH}
};
unsigned long prevMillis = 0;
int colCounter = 0;
bool isRunning = false;
void setup() {
Serial.begin(9600);
for (int i = 0; i < NUM_PINS; i++) {
pinMode(B_PINS[i], OUTPUT);
}
}
void loop() {
Serial.println("Hello");
// show each pattern row after P_DELAY
for (int patternRow = 0; patternRow < PATTERN_ROWS; patternRow++) {
Serial.print("Row\t");
Serial.println(patternRow);
Serial.print("Col\t");
//for (int patternCol = 0; patternCol < PATTERN_COLS; patternCol++) {
//digitalWrite(B_PINS[patternCol], PATTERNS[patternRow][patternCol]);
digitalWrite(B_PINS[colCounter], PATTERNS[patternRow][colCounter]);
//Serial.print(PATTERNS[patternRow][patternCol] ? "HIGH" : "LOW");
Serial.print(PATTERNS[patternRow][colCounter] ? "HIGH" : "LOW");
Serial.print("\t");
//}
if (millis() - prevMillis >= P_DELAY) {
prevMillis = millis();
colCounter++;
}
if (colCounter >= PATTERN_COLS) {
colCounter = 0;
Serial.println();
//delay(1000);
}
}
Serial.println();
}