So many here have helped me with many questions and curiosities, and I am getting close to a complete project. I would like to share what I am doing, because its a fun project. I have taken LED's and put them into a guitar, making it a fretless guitar. Follow the little red dots to what key and mode it is set to and whala, good lead guitar teacher all built in. I have actually got all my LED's into the fret board and am currently wiring it up in a test domain, to make sure my soldering is good to go. Well setting up 4 different patterns to every key is what I have accomplished so far, and I have tested it well on 3 8x8 led grids with 3 max 7219. (much thanks to Nick Gammon, and CrossRoads, and a few others here).
All of that code works, and now I am on part 2. The intent is to set up scales and perhaps songs of which one can follow the LED's as they flash on, to help themselves learn a song, or scale. I have started with a simple scale, well technically its a pentatonic, as a scale has 8 notes and a pentatonic has 5. I started here as it is simple.
What I have done on my bread board is hook up 1 max7219, 1 8x8 LED grid, and 1 potentiometer. I am unsure if I can do this digitally yet, so I started with what I know. My pentatonic scale is adjustable by the potentiometer to allow a variable speed. I am trying to figure out how to set up timing on this, aka 120 bmp (Beats Per Minute), as an example.
This is what I have done and here is my code, it works to the point it can speed up or slow down the LED flashing in a pattern based on the pentatonic. It is not quite what I am looking for, so I seek more help from the masters out there. I am using delay, which I think is the wrong way to go, hence I look for help.
Below is the code I use to vary the speed of LED flashing, however I am unsure how to time this up to bpm.
#include "binary.h" //Use this include for writing a byte in binary
#include "LedControl.h"//Use this include for controling LED's
LedControl lc=LedControl(13,12,11,1); /// Arduino data pin,clock pin,device selecting pin, number of max7219's
void setup()
{
lc.shutdown(0,false);
lc.setIntensity(0,5);
}
void loop()
{
ledPattern();
}
void ledPattern()
{
int potValue = analogRead(A0);
int delayValue = potValue;
lc.setRow(0,5,B10000000);
delay(delayValue);
lc.setRow(0,5,B00000000);
lc.setRow(0,5,B00010000);
delay(delayValue);
lc.setRow(0,5,B00000000);
lc.setRow(0,4,B10000000);
delay(delayValue);
lc.setRow(0,4,B00000000);
lc.setRow(0,4,B00100000);
delay(delayValue);
lc.setRow(0,4,B00000000);
lc.setRow(0,3,B10000000);
delay(delayValue);
lc.setRow(0,3,B00000000);
lc.setRow(0,3,B00100000);
delay(delayValue);
lc.setRow(0,3,B00000000);
lc.setRow(0,2,B10000000);
delay(delayValue);
lc.setRow(0,2,B00000000);
lc.setRow(0,2,B00100000);
delay(delayValue);
lc.setRow(0,2,B00000000);
lc.setRow(0,1,B10000000);
delay(delayValue);
lc.setRow(0,1,B00000000);
lc.setRow(0,1,B00010000);
delay(delayValue);
lc.setRow(0,1,B00000000);
lc.setRow(0,0,B10000000);
delay(delayValue);
lc.setRow(0,0,B00000000);
lc.setRow(0,0,B00010000);
delay(delayValue);
lc.setRow(0,0,B00000000);
}
I would like to thank everyone in advance for their help, this has been a fun first arduino project.