/* Blink Turns an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to the correct LED pin independent of which board is used. If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at: https://www.arduino.cc/en/Main/Products modified 8 May 2014 by Scott Fitzgerald modified 2 Sep 2016 by Arturo Guadalupi modified 8 Sep 2016 by Colby Newman This example code is in the public domain. https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink */ /* int col0 = 7; //1 int col1 = 8; //2 int row0 = 9; //3 int col2 = 10; //4 int row1 = 11; //5 int col3 = 12; //6 */ /* int col0 = 7; //1 int col1 = 8; //2 int col2 = 9; //4 int col3 = 10; //6 int row0 = 11; //3 int row1 = 12; //5 */ int col0 = 14; //1 int col1 = 4; //2 int col2 = 2; //4 int col3 = 15; //6 int row0 = 12; //3 int row1 = 13; //5 int ledsArr[] = {0,0,0,0,0,0,0,0}; void setup() { Serial.begin(115200); pinMode(col0, OUTPUT); pinMode(col1, OUTPUT); pinMode(col2, OUTPUT); pinMode(col3, OUTPUT); pinMode(row0, OUTPUT); pinMode(row1, OUTPUT); } void led0(bool state) { if(state) { digitalWrite(row0, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(col0, LOW); // turn the LED off by making the voltage LOW } else { digitalWrite(row0, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(col0, HIGH); // turn the LED off by making the voltage LOW } } void iterateUp() { for(int t = 100; t > 0; t -= 5) { for(int r = 11; r < 13; r++) { digitalWrite(r, HIGH); for(int c = 7; c < 11; c++) { digitalWrite(c, LOW); delay(t); digitalWrite(c, HIGH); } digitalWrite(r, LOW); } } for(int t = 0; t < 100; t++) { for(int r = 11; r < 13; r++) { digitalWrite(r, HIGH); for(int c = 7; c < 11; c++) { digitalWrite(c, LOW); delay(1); digitalWrite(c, HIGH); } digitalWrite(r, LOW); } } } void iterateDown() { for(int t = 1; t <= 100; t += 5) { for(int r = 11; r < 13; r++) { digitalWrite(r, HIGH); for(int c = 7; c < 11; c++) { digitalWrite(c, LOW); delay(t); digitalWrite(c, HIGH); } digitalWrite(r, LOW); } } } // the loop function runs over and over again forever void loop() { if (Serial.available()) { char c = Serial.read(); if (c == 'y') { iterateUp(); } else if (c == 'n') { iterateDown(); } } //set array of bits using led function //use array to write each pin function /** led0(true); delay(500); led0(false); delay(500); **/ }