/* Welcome to my 2x2x2 code! Last edit on 1-3-17 by Ben Drees If you have come here to make a function here are some helpful functions to make that function TLOff(); top layer off BLOff(); bottom layer off ALOff(); all layers off TLOn(); top layer on BLOn(); bottom layer on ALOn(); all layers on AOff(); all LEDs off AG(How Long); all green on AB(How Long); all blue on AR(How Long); all red on NB(); all blue off NR(); all red off NG(); all green off change(); say the top layer is on it will turn it off and turn the bottom layer on and vice versa choo(ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho, how long); lets you set certain LEDs on the top and bottom on without having the whole column on If you add twelve to a top layer number it will be the same only on the bottom. Ho is a holder and it basically turns nothing on Top layer 0-3 BLUE 4-7 GREEN 8-11 RED Bottom layer 12-15 BLUE 16-19 GREEN 20-23 RED This function is very helpful! */ // Change if you are using NPN transistors // const int on = 0; // change to 1 for NPN //////////////////////////////////////////////////////////////////////////////////// const int off = 1;// change to 0 for NPN /////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////Change to however you set your pins up for but this is what the picture const int FRR = 2; //Front Right Red const int FRG = 3; const int FRB = 4; const int FLR = 5; //Front Left Red const int FLG = 6; const int FLB = 7; const int BRR = 8; //Back Right Red const int BRG = 9; const int BRB = 10; const int BLR = 11; //Back Left Red const int BLG = 12; const int BLB = 13; int ho = 25; int G[] = { FRG, FLG, BRG, BLG }; int x; int B[] = { FRB, FLB, BRB, BLB }; int R[] = { FRR, FLR, BRR, BLR }; int All[] = { FRR, FRG, FRB, FLR, FLG, FLB, BRR, BRG, BRB, BLR, BLG, BLB }; int AllS1[] = { FRB, FLB, BRB, BLB, FRG, FLG, BRG, BLG, FRR, FLR, BRR, BLR, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho }; int AllS[] = { ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, FRB, FLB, BRB, BLB, FRG, FLG, BRG, BLG, FRR, FLR, BRR, BLR, ho, ho, ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho }; int ALLR[] = { FRR, FLG, BRB, BLR, FRG, FLB, BRR, BLG, FRB, FLR,BRG, BLB }; int layer[] { A0, A1 }; void setup() { for (int thisPin = 0; thisPin < 14; thisPin++) { pinMode(All[thisPin], OUTPUT); } for (int hello = 0; hello < 2; hello++) { //Sets everything to be an output. pinMode(layer[hello], OUTPUT); } randomSeed(analogRead(A3)); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void loop() { colorScroll(550); // delay before it switches color RR(50, 200); // how many times it runs, delay before it switches color checker(); fireCracker(); // Watch out this flashes really fastly spin(); goOn(); fullRandom(38,10,2); rain(75); fullRandom(25,50,2);//how many times it runs, delay before it switches color, higher the number the less lights will go on 2 is default oneOnOff(20,20); // speed turning on, speed turning off spinV2(37); //speed backwardOneOnOff(20,20); // speed turning on, speed turning off } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void checker() { TLOff(); BLOn(); for (int hhh = 0; hhh < 5; hhh++) { for (int thisPin = 0; thisPin < 100; thisPin++) { digitalWrite(R[3], HIGH); digitalWrite(R[0], HIGH); //Same concept as choo (scroll to choo for more explenation) AB(0); //This was made befor I made that function delay(2); digitalWrite(R[3], LOW); digitalWrite(R[0], LOW); NB(); change(); AB(0); digitalWrite(R[1], HIGH); digitalWrite(R[2], HIGH); delay(2); NB(); digitalWrite(R[1], LOW); digitalWrite(R[2], LOW); change(); } for (int thisPin = 0; thisPin < 100; thisPin++) { digitalWrite(R[1], HIGH); digitalWrite(R[2], HIGH); AB(0); delay(2); digitalWrite(R[1], LOW); digitalWrite(R[2], LOW); NB(); change(); AB(0); digitalWrite(R[3], HIGH); digitalWrite(R[0], HIGH); delay(2); NB(); digitalWrite(R[3], LOW); digitalWrite(R[0], LOW); change(); } } } void AG(int dc) { digitalWrite(G[0], HIGH); digitalWrite(G[1], HIGH); digitalWrite(G[2], HIGH); digitalWrite(G[3], HIGH); delay(dc); } void AR(int da) { for (int r = 0; r < 4; r++) { digitalWrite(R[r], HIGH); } delay(da); } void AB(int db) { for (int b = 0; b < 4; b++) { digitalWrite(B[b], HIGH); } delay(db); } void NG() { for (int g = 0; g < 4; g++) { digitalWrite(G[g], LOW); } } void NR() { for (int r = 0; r < 4; r++) { digitalWrite(R[r], LOW); } } void NB() { for (int b = 0; b < 4; b++) { digitalWrite(B[b], LOW); } } void AllOff() { for (int a = 0; a < 12; a++) { digitalWrite(All[a], LOW); digitalWrite(AllS[a], LOW); digitalWrite(AllS1[a], LOW); } } void AllOn() { for (int a = 0; a < 12; a++) { digitalWrite(All[a], HIGH); } } void TLOff() { digitalWrite(layer[1], off); } void BLOff() { digitalWrite(layer[0], off); } void TLOn() { digitalWrite(layer[1], on); } void BLOn() { digitalWrite(layer[0], on); } void change() { if (x == 1) { digitalWrite(layer[1], on); digitalWrite(layer[0], off); x = 0; } else { digitalWrite(layer[1], off); digitalWrite(layer[0], on); x = 1; } } void ALOn() { digitalWrite(layer[1], on); digitalWrite(layer[0], on); } void ALOff() { digitalWrite(layer[1], off); digitalWrite(layer[0], off); } void RSO(int roo, int dd) { for (int ro = 0; ro < roo; ro++) { digitalWrite(All[random(0, 13)], HIGH); delay(dd); } } void AOff() { for (int thisPin = 0; thisPin < 12; thisPin++) { digitalWrite(All[thisPin], LOW); } } void RR(int rr, int rd) { for (int ro = 0; ro < rr; ro++) { int sdf = random(0, 2); // picks a random layer int rrr = random(0, 4); //picks a random colunm int asdf = random(0, 2); //Decides if blue is on//////// int rando = random(0, 2); //Decides if red is on /// So the colors can mix and create purple yellow white and cyan int ran = random(0, 2); // Decides if green is on///// if (rrr == 0) { digitalWrite(All[0], asdf); digitalWrite(All[1], rando); digitalWrite(All[2], ran); } if (rrr == 1) { digitalWrite(All[3], asdf); digitalWrite(All[4], rando); digitalWrite(All[5], ran); } if (rrr == 2) { digitalWrite(All[6], asdf); digitalWrite(All[7], rando); digitalWrite(All[8], ran); } if (rrr == 3) { digitalWrite(All[9], asdf); digitalWrite(All[10], rando); digitalWrite(All[11], ran); } digitalWrite(layer[sdf], off); if (sdf == 1) { digitalWrite(layer[0], on); } else { digitalWrite(layer[1], on); } // digitalWrite(All[rrr], HIGH); delay(rd); AOff(); } } void colorScroll(int todo) // Goes through all the colors { ALOn(); AR(1); AG(1); AB(todo); NR(); delay(todo); NG(); AR(todo); NB(); AG(todo); NG(); NR(); AB(todo); NB(); AR(todo); NR(); AG(todo); NG(); } void fireCracker() { RR(110, 20); //Just the random function really fast but I wanted to make it easy to get rid of if you dont like it } void spin() { //Basically makes the LED spin while turning layers on and off respectively AOff(); for (int qwerty = 0; qwerty < 2; qwerty++) { TLOff(); BLOn(); digitalWrite(G[0], HIGH); digitalWrite(R[0], HIGH); delay(350); digitalWrite(G[0], LOW); digitalWrite(R[0], LOW); digitalWrite(G[1], HIGH); digitalWrite(R[1], HIGH); delay(350); digitalWrite(G[1], LOW); digitalWrite(R[1], LOW); digitalWrite(G[3], HIGH); digitalWrite(R[3], HIGH); delay(350); digitalWrite(G[3], LOW); digitalWrite(R[3], LOW); digitalWrite(G[2], HIGH); digitalWrite(R[2], HIGH); delay(350); digitalWrite(G[2], LOW); digitalWrite(R[2], LOW); } for (int qwety = 0; qwety < 4; qwety++) { TLOn(); BLOff(); digitalWrite(B[0], HIGH); digitalWrite(R[0], HIGH); delay(60); digitalWrite(B[0], LOW); digitalWrite(R[0], LOW); digitalWrite(B[1], HIGH); digitalWrite(R[1], HIGH); delay(60); digitalWrite(B[1], LOW); digitalWrite(R[1], LOW); digitalWrite(B[3], HIGH); digitalWrite(R[3], HIGH); delay(60); digitalWrite(B[3], LOW); digitalWrite(R[3], LOW); digitalWrite(B[2], HIGH); digitalWrite(R[2], HIGH); delay(60); digitalWrite(B[2], LOW); digitalWrite(R[2], LOW); } for (int qwty = 0; qwty < 4; qwty++) { TLOn(); BLOff(); digitalWrite(B[0], HIGH); digitalWrite(G[0], HIGH); delay(160); digitalWrite(B[0], LOW); digitalWrite(G[0], LOW); digitalWrite(B[1], HIGH); digitalWrite(G[1], HIGH); delay(160); digitalWrite(B[1], LOW); digitalWrite(G[1], LOW); TLOff(); BLOn(); digitalWrite(B[1], HIGH); digitalWrite(G[1], HIGH); delay(160); digitalWrite(B[1], LOW); digitalWrite(G[1], LOW); digitalWrite(B[0], HIGH); digitalWrite(G[0], HIGH); delay(160); digitalWrite(B[0], LOW); digitalWrite(G[0], LOW); TLOn(); BLOff(); } for (int qwty = 0; qwty < 4; qwty++) { TLOn(); BLOff(); digitalWrite(B[2], HIGH); digitalWrite(G[2], HIGH); digitalWrite(R[2], HIGH); delay(160); digitalWrite(B[2], LOW); digitalWrite(G[2], LOW); digitalWrite(R[2], LOW); digitalWrite(B[0], HIGH); digitalWrite(G[0], HIGH); digitalWrite(R[0], HIGH); delay(160); TLOff(); BLOn(); delay(160); digitalWrite(B[0], LOW); digitalWrite(G[0], LOW); digitalWrite(R[0], LOW); digitalWrite(B[2], HIGH); digitalWrite(G[2], HIGH); digitalWrite(R[2], HIGH); delay(160); digitalWrite(B[2], LOW); digitalWrite(G[2], LOW); digitalWrite(R[2], LOW); TLOn(); BLOff(); } } void goOn() { TLOn(); BLOn(); AllOff(); for (int cat = 0; cat < 12; cat++) // Had to make a different array because it looked boring using All[] { digitalWrite(ALLR[cat], HIGH); delay(300); } } void rain(int bb) { AOff(); ALOff(); choo(ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, bb); choo(0, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, bb); // Top layer 0-3 BLUE 4-7 GREEN 8-11 RED choo(12, ho, ho, ho, ho, ho, ho, ho, ho, ho, ho, bb); // Bottom layer 12-15 BLUE 16-19 GREEN 20-23 RED choo(12, 7, ho, ho, ho, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, ho, ho, ho, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 5, ho, ho, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 17, ho, ho, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 17, 9, ho, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 17, 21, ho, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 17, 21, 2, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 17, 21, 14, ho, ho, ho, ho, ho, ho, bb); choo(12, 19, 17, 21, 14, 8, 11, ho, ho, ho, ho, bb); choo(12, 19, 17, 21, 14, 20, 23, ho, ho, ho, ho, bb); choo(12, 19, 17, 21, 14, 20, 23, 10, 5, ho, ho, bb); choo(12, 19, 17, 21, 14, 20, 23, 22, 17, ho, ho, bb); choo(12, 19, 17, 21, 14, 20, 23, 22, 17, 4, ho, bb); choo(12, 19, 17, 21, 14, 20, 23, 22, 17, 16, ho, bb); choo(12, 19, 17, 21, 14, 20, 23, 22, 17, 16, 1, bb); choo(12, 19, 17, 21, 14, 20, 23, 22, 17, 16, 13, bb); } void choo(int az, int bz, int cz, int dz, int ez, int fz, int gz, int hz, int iz, int jz, int kz, int jjj) //13++ for Bottom Top First!! { for (int hel = 0; hel < jjj; hel++) { BLOff(); /// This turns the layers on and off opposite to eachother so fast //it appears they are both on TLOn(); //Makes it possible to have the lights you want on the bottom and top on digitalWrite(AllS1[az], HIGH); // instead of lighting up the whole column digitalWrite(AllS1[bz], HIGH); //Say you wanted a green light on the bottom of a column and a red light on //top of the column. you can use this so the column doesnt light up as purple digitalWrite(AllS1[cz], HIGH); //The Array AllS starts at 12 so if you put that number in it lights digitalWrite(AllS1[dz], HIGH); //Up a LED on the bottom layer and not the top because 12 on array AllS1 digitalWrite(AllS1[ez], HIGH); //Is really 77 or ho (holder) digitalWrite(AllS1[fz], HIGH); digitalWrite(AllS1[gz], HIGH); digitalWrite(AllS1[hz], HIGH); digitalWrite(AllS1[iz], HIGH); digitalWrite(AllS1[jz], HIGH); digitalWrite(AllS1[kz], HIGH); delay(2); //Has the top layer and certain lights on digitalWrite(AllS1[az], LOW); digitalWrite(AllS1[bz], LOW); digitalWrite(AllS1[cz], LOW); digitalWrite(AllS1[dz], LOW); digitalWrite(AllS1[ez], LOW); digitalWrite(AllS1[fz], LOW); digitalWrite(AllS1[gz], LOW); digitalWrite(AllS1[hz], LOW); digitalWrite(AllS1[iz], LOW); digitalWrite(AllS1[jz], LOW); digitalWrite(AllS1[kz], LOW); change(); digitalWrite(AllS[az], HIGH); digitalWrite(AllS[bz], HIGH); digitalWrite(AllS[cz], HIGH); digitalWrite(AllS[dz], HIGH); digitalWrite(AllS[ez], HIGH); digitalWrite(AllS[fz], HIGH); digitalWrite(AllS[gz], HIGH); digitalWrite(AllS[hz], HIGH); digitalWrite(AllS[iz], HIGH); digitalWrite(AllS[jz], HIGH); digitalWrite(AllS[kz], HIGH); delay(2); // Has the bottom layer and certain lights on digitalWrite(AllS[az], LOW); digitalWrite(AllS[bz], LOW); digitalWrite(AllS[cz], LOW); digitalWrite(AllS[dz], LOW); digitalWrite(AllS[ez], LOW); digitalWrite(AllS[fz], LOW); digitalWrite(AllS[gz], LOW); digitalWrite(AllS[hz], LOW); digitalWrite(AllS[iz], LOW); digitalWrite(AllS[jz], LOW); digitalWrite(AllS[kz], LOW); change(); } } void fullChoo(int az, int bz, int cz, int dz, int ez, int fz, int gz, int hz, int iz, int jz, int kz, int lz, int mz, int nz, int oz, int pz, int qz, int rz, int sz, int tz, int uz, int vz, int xz, int zz, int jjj) //13++ for Bottom Top First!! { for (int hel = 0; hel < jjj; hel++) { BLOff(); /// This turns the layers on and off opposite to eachother so fast //it appears they are both on TLOn(); //Makes it possible to have the lights you want on the bottom and top on digitalWrite(AllS1[az], HIGH); // instead of lighting up the whole column digitalWrite(AllS1[bz], HIGH); //Say you wanted a green light on the bottom of a column and a red light on //top of the column. you can use this so the column doesnt light up as purple digitalWrite(AllS1[cz], HIGH); //The Array AllS starts at 12 so if you put that number in it lights digitalWrite(AllS1[dz], HIGH); //Up a LED on the bottom layer and not the top because 12 on array AllS1 digitalWrite(AllS1[ez], HIGH); //Is really 77 or ho (holder or like hohohoho because its around Christmas) digitalWrite(AllS1[fz], HIGH); digitalWrite(AllS1[gz], HIGH); digitalWrite(AllS1[hz], HIGH); digitalWrite(AllS1[iz], HIGH); digitalWrite(AllS1[jz], HIGH); digitalWrite(AllS1[kz], HIGH); digitalWrite(AllS1[lz], HIGH); digitalWrite(AllS1[mz], HIGH); digitalWrite(AllS1[nz], HIGH); digitalWrite(AllS1[oz], HIGH); digitalWrite(AllS1[pz], HIGH); digitalWrite(AllS1[qz], HIGH); digitalWrite(AllS1[rz], HIGH); digitalWrite(AllS1[sz], HIGH); digitalWrite(AllS1[tz], HIGH); digitalWrite(AllS1[uz], HIGH); digitalWrite(AllS1[vz], HIGH); digitalWrite(AllS1[xz], HIGH); digitalWrite(AllS1[zz], HIGH); delay(2); //Has the top layer and certain lights on digitalWrite(AllS1[az], LOW); // instead of lighting up the whole column digitalWrite(AllS1[bz], LOW); //Say you wanted a green light on the bottom of a column and a red light on //top of the column. you can use this so the column doesnt light up as purple digitalWrite(AllS1[cz], LOW); //The Array AllS starts at 12 so if you put that number in it lights digitalWrite(AllS1[dz], LOW); //Up a LED on the bottom layer and not the top because 12 on array AllS1 digitalWrite(AllS1[ez], LOW); //Is really 77 or ho (holder) digitalWrite(AllS1[fz], LOW); digitalWrite(AllS1[gz], LOW); digitalWrite(AllS1[hz], LOW); digitalWrite(AllS1[iz], LOW); digitalWrite(AllS1[jz], LOW); digitalWrite(AllS1[kz], LOW); digitalWrite(AllS1[lz], LOW); digitalWrite(AllS1[mz], LOW); digitalWrite(AllS1[nz], LOW); digitalWrite(AllS1[oz], LOW); digitalWrite(AllS1[pz], LOW); digitalWrite(AllS1[qz], LOW); digitalWrite(AllS1[rz], LOW); digitalWrite(AllS1[sz], LOW); digitalWrite(AllS1[tz], LOW); digitalWrite(AllS1[uz], LOW); digitalWrite(AllS1[vz], LOW); digitalWrite(AllS1[xz], LOW); digitalWrite(AllS1[zz], LOW); change(); digitalWrite(AllS[az], HIGH); // instead of lighting up the whole column digitalWrite(AllS[bz], HIGH); //Say you wanted a green light on the bottom of a column and a red light on //top of the column. you can use this so the column doesnt light up as purple digitalWrite(AllS[cz], HIGH); //The Array AllS starts at 12 so if you put that number in it lights digitalWrite(AllS[dz], HIGH); //Up a LED on the bottom layer and not the top because 12 on array AllS1 digitalWrite(AllS[ez], HIGH); //Is really 77 or ho (holder) digitalWrite(AllS[fz], HIGH); digitalWrite(AllS[gz], HIGH); digitalWrite(AllS[hz], HIGH); digitalWrite(AllS[iz], HIGH); digitalWrite(AllS[jz], HIGH); digitalWrite(AllS[kz], HIGH); digitalWrite(AllS[lz], HIGH); digitalWrite(AllS[mz], HIGH); digitalWrite(AllS[nz], HIGH); digitalWrite(AllS[oz], HIGH); digitalWrite(AllS[pz], HIGH); digitalWrite(AllS[qz], HIGH); digitalWrite(AllS[rz], HIGH); digitalWrite(AllS[sz], HIGH); digitalWrite(AllS[tz], HIGH); digitalWrite(AllS[uz], HIGH); digitalWrite(AllS[vz], HIGH); digitalWrite(AllS[xz], HIGH); digitalWrite(AllS[zz], HIGH); delay(2); // Has the bottom layer and certain lights on digitalWrite(AllS[az], LOW); // instead of lighting up the whole column digitalWrite(AllS[bz], LOW); //Say you wanted a green light on the bottom of a column and a red light on //top of the column. you can use this so the column doesnt light up as purple digitalWrite(AllS[cz], LOW); //The Array AllS starts at 12 so if you put that number in it lights digitalWrite(AllS[dz], LOW); //Up a LED on the bottom layer and not the top because 12 on array AllS1 digitalWrite(AllS[ez], LOW); //Is really 77 or ho (holder) digitalWrite(AllS[fz], LOW); digitalWrite(AllS[gz], LOW); digitalWrite(AllS[hz], LOW); digitalWrite(AllS[iz], LOW); digitalWrite(AllS[jz], LOW); digitalWrite(AllS[kz], LOW); digitalWrite(AllS[lz], LOW); digitalWrite(AllS[mz], LOW); digitalWrite(AllS[nz], LOW); digitalWrite(AllS[oz], LOW); digitalWrite(AllS[pz], LOW); digitalWrite(AllS[qz], LOW); digitalWrite(AllS[rz], LOW); digitalWrite(AllS[sz], LOW); digitalWrite(AllS[tz], LOW); digitalWrite(AllS[uz], LOW); digitalWrite(AllS[vz], LOW); digitalWrite(AllS[xz], LOW); digitalWrite(AllS[zz], LOW); change(); } } void fullRandom(int gjg,int ttt,int zz) { for(int jgj = 0; jgj < gjg; jgj++) { int aa, bb, cc, dd, e, f, g, h, i, j, k, ll, mm, nn, oo, p, q,r, s, t, u, v, w, y; int r1 = random(0, zz); int r2 = random(0, zz); int r3 = random(0, zz); int r4 = random(0, zz); int r5 = random(0, zz); int r6 = random(0, zz); int r7 = random(0, zz); int r8 = random(0, zz); int r9 = random(0, zz); int r10 = random(0, zz); int r11 = random(0, zz); int r12 = random(0, zz); int r13 = random(0, zz); int r14 = random(0, zz); int r15 = random(0, zz); int r16 = random(0, zz); int r17 = random(0, zz); int r18 = random(0, zz); int r19 = random(0, zz); int r20 = random(0, zz); int r21 = random(0, zz); int r22 = random(0, zz); int r23 = random(0, zz); int r24 = random(0, zz); if (r1 == 1) { aa = 0; } else { aa = ho; } if (r2 == 1) { bb = 1; } else { bb = ho; } if (r3 == 1) { cc = 2; } else { cc = ho; } if (r4 == 1) { dd = 3; } else { dd = ho; } if (r5 == 1) { e = 4; } else { e = ho; } if (r6 == 1) { f = 5; } else { f = ho; } if (r7 == 1) { g = 6; } else { g = ho; } if (r8 == 1) { h = 7; } else { h = ho; } if (r9 == 1) { i = 8; } else { i = ho; } if (r10 == 1) { j = 9; } else { j = ho; } if (r11 == 1) { k = 10; } else { k = ho; } if (r12 == 1) { ll = 11; } else { ll = ho; } if (r13 == 1) { mm = 12; } else { mm = ho; } if (r14 == 1) { nn = 13; } else { nn = ho; } if (r15 == 1) { oo = 14; } else { oo = ho; } if (r16 == 1) { p = 15; } else { p = ho; } if (r17 == 1) { q = 16; } else { q = ho; } if (r18 == 1) { r = 17; } else { r = ho; } if (r19 == 1) { s = 18; } else { s = ho; } if (r20 == 1) { t = 19; } else { t = ho; } if (r21 == 1) { u = 20; } else { u = ho; } if (r22 == 1) { v = 21; } else { v = ho; } if (r23 == 1) { w = 22; } else { w = ho; } if (r24 == 1) { y = 23; } else { y = ho; } fullChoo(aa,bb,cc,dd,e,f,g,h,i,j,k,ll,mm,nn,oo,p,q,r,s,t,u,v,w,y,ttt); } } void oneOnOff(int oooo, int ffff) { fullChoo(ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,4); for(int ben = 47; ben > 22; ben--) { fullChoo(ben,ben - 1,ben - 2,ben - 3,ben - 4,ben - 5,ben - 6,ben - 7,ben - 8,ben - 9,ben - 10,ben - 11,ben - 12,ben - 13,ben - 14,ben - 15,ben - 16,ben - 17,ben - 18,ben - 19,ben - 20,ben - 21,ben - 22,ben - 23,oooo); } for(int ben = 0; ben < 24; ben++) { fullChoo(ben,ben + 1,ben + 2,ben + 3,ben + 4,ben + 5,ben + 6,ben + 7,ben + 8,ben + 9,ben + 10,ben + 11,ben + 12,ben + 13,ben + 14,ben + 15,ben + 16,ben + 17,ben + 18,ben + 19,ben + 20,ben + 21,ben + 22,ben + 23,ffff); } } void backwardOneOnOff(int oooo, int ffff) { fullChoo(ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,4); for(int ben = 0; ben < 24; ben++) { fullChoo(ben,ben + 1,ben + 2,ben + 3,ben + 4,ben + 5,ben + 6,ben + 7,ben + 8,ben + 9,ben + 10,ben + 11,ben + 12,ben + 13,ben + 14,ben + 15,ben + 16,ben + 17,ben + 18,ben + 19,ben + 20,ben + 21,ben + 22,ben + 23,ffff); } for(int ben = 47; ben > 22; ben--) { fullChoo(ben,ben - 1,ben - 2,ben - 3,ben - 4,ben - 5,ben - 6,ben - 7,ben - 8,ben - 9,ben - 10,ben - 11,ben - 12,ben - 13,ben - 14,ben - 15,ben - 16,ben - 17,ben - 18,ben - 19,ben - 20,ben - 21,ben - 22,ben - 23,oooo); } } void spinV2(int Speed) { int rg; int bg; int gg; for(int fp = 0; fp < 3; fp++) { int good = random(1,4); int good1 = random(1,4); int good2 = random(1,4); if(good == 1 || good1 == 1 || good2 == 1) { rg = 20; } else{ rg = 50; } if(good == 2 || good1 == 2 || good2 == 2) { gg = 16; } else{ gg = 50; } if(good == 3 || good1 == 3 || good2 == 3) { bg = 12; } else{ bg = 50; } for(int jkk = 0; jkk < 2; jkk++) { choo(rg, gg, bg, rg + 1, gg + 1, bg + 1, ho, ho, ho, ho, ho,Speed); choo(rg - 12, gg - 12, bg - 12, rg - 11, gg - 11, bg - 11, ho, ho, ho, ho, ho, Speed); choo(rg - 10, gg - 10, bg - 10, rg - 9, gg - 9, bg - 9, ho, ho, ho, ho, ho, Speed); choo(rg + 2, gg + 2, bg + 2, rg + 3, gg + 3, bg + 3, ho, ho, ho, ho, ho,Speed); } } for(int fp = 0; fp < 3; fp++) ////////////////////////////////////////////////////////////////////////////////////////////// { int good = random(1,4); int good1 = random(1,4); int good2 = random(1,4); if(good == 1 || good1 == 1 || good2 == 1) { rg = 20; } else{ rg = 50; } if(good == 2 || good1 == 2 || good2 == 2) { gg = 16; } else{ gg = 50; } if(good == 3 || good1 == 3 || good2 == 3) { bg = 12; } else{ bg = 50; } for(int jkk = 0; jkk < 2; jkk++) { choo(rg, gg, bg, rg + 2, gg + 2, bg + 2, ho, ho, ho, ho, ho,Speed); choo(rg - 12, gg - 12, bg - 12, rg - 10, gg - 10, bg - 10, ho, ho, ho, ho, ho, Speed); choo(rg - 11, gg - 11, bg - 11, rg - 9, gg - 9, bg - 9, ho, ho, ho, ho, ho, Speed); choo(rg + 1, gg + 1, bg + 1, rg + 3, gg + 3, bg + 3, ho, ho, ho, ho, ho,Speed); } } for(int fp = 0; fp < 5; fp++) ////////////////////////////////////////////////////////////////////////////////////////////// { int rgg; int ggg; int bgg; int good = random(1,4); int good1 = random(1,4); int good2 = random(1,4); int goodd = random(1,4); int goodd1 = random(1,4); int goodd2 = random(1,4); if(good == 1 || good1 == 1 || good2 == 1) { rg = 20; } else{ rg = 50; } if(good == 2 || good1 == 2 || good2 == 2) { gg = 16; } else{ gg = 50; } if(good == 3 || good1 == 3 || good2 == 3) { bg = 12; } else{ bg = 50; } if(goodd == 1 || goodd1 == 1 || goodd2 == 1) { rgg = 20; } else{ rgg = 50; } if(goodd == 2 || goodd1 == 2 || goodd2 == 2) { ggg = 16; } else{ ggg = 50; } if(goodd == 3 || goodd1 == 3 || goodd2 == 3) { bgg = 12; } else{ bgg = 50; } for(int jkk = 0; jkk < 1; jkk++) { choo(rgg, ggg, bgg, rgg + 2, ggg + 2, bgg + 2, ho, ho, ho, ho, ho,Speed); choo(rgg - 12, ggg - 12, bgg - 12, rgg - 10, ggg - 10, bgg - 10, ho, ho, ho, ho, ho, Speed); choo(rgg - 11, ggg - 11, bgg - 11, rgg - 9, ggg - 9, bgg - 9, ho, ho, ho, ho, ho, Speed); choo(rgg + 1, ggg + 1, bgg + 1, rgg + 3, ggg + 3, bgg + 3, ho, ho, ho, ho, ho,Speed); choo(rg, gg, bg, rg + 1, gg + 1, bg + 1, ho, ho, ho, ho, ho,Speed); choo(rg - 12, gg - 12, bg - 12, rg - 11, gg - 11, bg - 11, ho, ho, ho, ho, ho, Speed); choo(rg - 10, gg - 10, bg - 10, rg - 9, gg - 9, bg - 9, ho, ho, ho, ho, ho, Speed); choo(rg + 2, gg + 2, bg + 2, rg + 3, gg + 3, bg + 3, ho, ho, ho, ho, ho,Speed); } } for(int fp = 0; fp < 6; fp++) ////////////////////////////////////////////////////////////////////////////////////////////// { int rgg; int ggg; int bgg; int good = random(1,4); int good1 = random(1,4); int good2 = random(1,4); int goodd = random(1,4); int goodd1 = random(1,4); int goodd2 = random(1,4); if(good == 1 || good1 == 1 || good2 == 1) { rg = 20; } else{ rg = 50; } if(good == 2 || good1 == 2 || good2 == 2) { gg = 16; } else{ gg = 50; } if(good == 3 || good1 == 3 || good2 == 3) { bg = 12; } else{ bg = 50; } if(goodd == 1 || goodd1 == 1 || goodd2 == 1) { rgg = 20; } else{ rgg = 50; } if(goodd == 2 || goodd1 == 2 || goodd2 == 2) { ggg = 16; } else{ ggg = 50; } if(goodd == 3 || goodd1 == 3 || goodd2 == 3) { bgg = 12; } else{ bgg = 50; } fullChoo(rgg, ggg, bgg, rgg + 2, ggg + 2, bgg + 2,rg, gg, bg, rg + 1, gg + 1, bg + 1,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,Speed); fullChoo(rgg - 12, ggg - 12, bgg - 12, rgg - 10, ggg - 10, bgg - 10,rg - 12, gg - 12, bg - 12, rg - 11, gg - 11, bg - 11,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,Speed); fullChoo(rgg - 11, ggg - 11, bgg - 11, rgg - 9, ggg - 9, bgg - 9,rg - 10, gg - 10, bg - 10, rg - 9, gg - 9, bg - 9,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,Speed); fullChoo(rgg + 1, ggg + 1, bgg + 1, rgg + 3, ggg + 3, bgg + 3,rg + 2, gg + 2, bg + 2, rg + 3, gg + 3, bg + 3,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,ho,Speed); } } //12-15 BLUE 16-19 GREEN 20-23 RED //0-3 BLUE 4-7 GREEN 8-11 RED