int bpm, tempo; // The higher the number, the slower the timing. int c1 = 8; int c2 = 9; int c3 = 10; int c4 = 11; int c5 = 12; int ch1, ch2, ch3, ch4, ch5; void setup() { // use a for loop to initialize each pin as an output: for (int thisPin = 8; thisPin < 13; thisPin++) { pinMode(thisPin, OUTPUT); } } void loop() { // bpm, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16 patron(480, 31, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); // compas 1 patron(960, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ); // compas 2.0 patron(960, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0 ); // compas 2.3 patron(480, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ); // compas 3 patron(960, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0 ); // compas 4.0 patron(960, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); // compas 4.3 // bpm, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16 patron(960, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); // compas 5.0 patron(960, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ); // compas 5.3 patron(960, 2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0 ); // compas 6.0 patron(960, 8, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ); // compas 6.3 patron(480, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ); // compas 7 patron(480, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ); // compas 8 // bpm, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16 } void patron(int bpm, int step1, int step2, int step3, int step4, int step5, int step6, int step7, int step8, int step9, int step10, int step11, int step12, int step13, int step14, int step15, int step16 ) { int seq[16] = {step1, step2, step3, step4, step5, step6, step7, step8, step9, step10, step11, step12, step13, step14, step15, step16}; for(int i=0 ; i<16 ; i++) { ch1 = seq[i] & 0x01; ch2 = (seq[i]>>1) & 0x01; ch3 = (seq[i]>>2) & 0x01; ch4 = (seq[i]>>3) & 0x01; ch5 = (seq[i]>>4) & 0x01; digitalWrite(c1,ch1); digitalWrite(c2,ch2); digitalWrite(c3,ch3); digitalWrite(c4,ch4); digitalWrite(c5,ch5); tempo = 60000/bpm; delay(tempo); } void luz(int bpm, int canal, int color, int step1, int step2, int step3, int step4, int step5, int step6, int step7, int step8, int step9, int step10, int step11, int step12, int step13, int step14, int step15, int step16 ) { }