From f88fc7a9f263a8d8d274883932ed1cbad4f2948a Mon Sep 17 00:00:00 2001 From: KaraBun Date: Mon, 19 Dec 2022 23:55:37 -0500 Subject: [PATCH] Initial variable setup. --- Lanes.ino | 59 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/Lanes.ino b/Lanes.ino index d9765a5..38ea4ad 100644 --- a/Lanes.ino +++ b/Lanes.ino @@ -1,22 +1,55 @@ +#include -int Lane1 = 9; // OutputChannel 1 +const int Lane1Pin = 9; //Output Channel 1 +const int Lane2Pin = 10; //Output Channel 2 +const int Lane3Pin = 11; //Output Channel 3 +const int Enc1P1 = 2; //Encoder 1 Pin 1 to Interrupt +const int Enc2P1 = 3; //Encoder 2 Pin 1 to Interrupt +const int Enc1P2 = 14; //Encoder 1 Pin 2 to non-Interrupting pin because we only have 2 +const int Enc2P2 = 15; //Encoder 2 Pin 2 to non-Interrupting pin because we only have 2 +const int Enc1Btn = 16; //Encoder 1 Button +const int Enc2Btn = 17; //Encoder 2 Button +const int ClockIn = 20; //Clock In + +Encoder LeftEnc( Enc1P1, Enc1P2); +Encoder RightEnc( Enc2P1, Enc2P2); + +int E1 = 0; +int E2 = 0; +bool E1Btn = false; +bool E2Btn = false; +bool ClockState = false; +int PpQN = 24; +float Clock = 120; +float ClockTick = 1/((Clock * PpQN)/60); +long Lane1Pos, Lane2Pos, Lane3Pos, Lane1Time, Lane2Time, Lane3Time= 0; + + +int Lane1[4,16]; +int Lane2[4,16]; +int Lane3[4,16]; void setup() { - // nothing happens in setup + + //Open Serial for output prior to installing a screen + Serial.begin( 115200 ); + + randomSeed(analogread(A7)); + + //Clear the Lanes + for(int i = 0; i < 16; i++){ + Lane1[0,i] = random(0, 96); + Lane1[1,i] = random(0, 255); + Lane1[2,i] = random(0, 2); + Lane1[3,i] = random(0,255); + for(int j = 0; j < 4; j++){ + Lane2[j,i] = Lane3[i,j] = 0; + } + } } void loop() { - for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) { - analogWrite(Lane1, fadeValue); - delayMicroseconds(30); - } + delay(1); - // fade out from max to min in increments of 5 points: - for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) { - // sets the value (range from 0 to 255): - analogWrite(Lane1, fadeValue); - // wait for 30 milliseconds to see the dimming effect - delayMicroseconds(30); - } } \ No newline at end of file