Hey all! I am trying to use 3 meters of Neopixels to show tempo in a large scale drum machine installation. I want the send a quarter note pulse into the arduino from the drum machine and have the led strip light up from left to right over 4 beats and then reset back at the beginning at the 5th beat (aka 1). Any hints on how I would I go about programming this in arduino language? Thank you so much for any guidance!
I want the send a quarter note pulse
What, exactly, is a "quarter note pulse"? Is that analog or digital? How does it differ from a half note pulse?
over 4 beats and then reset back at the beginning at the 5th beat (aka 1).
How is the Arduino supposed to know how long 4 beats takes?
I guess "quarter note pulse" is kinda confusing..itll just be a constant analog pulse being sent to arduino. Its coming from a rhythm machine that is attached to an old wurlitzer organ.
I figured I could program the arduino to count 4 pulses and then reset the LED animation. Whaddya think?
Its coming from a rhythm machine that is attached to an old wurlitzer organ.
Have you actually tried to read this pulse? How long does it last? What voltage are you reading?
I figured I could program the arduino to count 4 pulses and then reset the LED animation. Whaddya think?
I think you could try.
Ok upon doing some thinking and lots of research I need a little guidance to start coding. I am going to try to modify this Cylon Scrolling larson scanner code from EternalCore to scroll across over the four bars and reset on the 1.
//NeoPixel LED Digital Strip Cylon Eye v1.10 Created by EternalCore
#include <Adafruit_NeoPixel.h>
//Settings:
#define PIN 6 //The Pin out your Neopixel DIN strip/stick is connected to (Default is 6)
#define TPIXEL 60 //The total amount of pixel's/led's in your connected strip/stick (Default is 60)
//To change the timing of between pulses change the number in int 'refresh', to change the speed of it scrolling change the number in int 'wait_T' and 1000 is equal to 1second.
int wait_T=40; //This is the delay between moving back and forth and per pixel
int refresh=400;
int PixelCount=60; //Set this to the AMOUNT of Led's/Pixels you have or want to use on your strip And It can be used to tell where to Stop then return the eye at in the strip
int Pixel_Start_End=0; //Set this to where you want it to Start/End at
boolean UsingBar = false; //Set this to true If you are using the 8x1 Neopixel Bar Or you want to only use 3 leds for the scanner.
Adafruit_NeoPixel strip = Adafruit_NeoPixel(TPIXEL, PIN, NEO_GRB + NEO_KHZ800); //Standered Strip function
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
//Serial.begin(9600); //Used For pixel Count Debugging
}
void loop() {
//Example: CylonEyeUp(Center_Dot_Color, Second_Dot_color, Third_Dot_color, wait_T, PixelCount, Pixel_Start_End);
CylonEyeUp(strip.Color(175,0,0), strip.Color(25,0,0), strip.Color(10,0,0), wait_T, PixelCount, Pixel_Start_End);
delay(wait_T);
//Example: CylonEyeDown(Center_Dot_Color, Second_Dot_color, Third_Dot_color, wait_T, PixelCount, Pixel_Start_End);
//CylonEyeDown(strip.Color(175,0,0), strip.Color(25,0,0), strip.Color(10,0,0), wait_T, PixelCount, Pixel_Start_End);
//delay(wait_T);
//Example: CylonEyeClear(wait_T, PixelCount, Pixel_Start_End);
CylonEyeClear(wait_T, PixelCount, Pixel_Start_End);
delay(refresh);
}
void CylonEyeClear(uint8_t Delay, int TotalPixels, int pStart) {
for(int i=pStart; i<TotalPixels+2; i++) {
strip.setPixelColor(i, strip.Color(0,0,0)); //Clears the dots
strip.show();
//Serial.println(i); //Used For pixel Count Debugging
//delay(Delay);
}
}
void CylonEyeUp(uint32_t Co, uint32_t Ct, uint32_t Ctt, uint8_t Delay, int TotalPixels, int pStart) {
for(int i=pStart; i<TotalPixels; i++) {
if(!UsingBar) { strip.setPixelColor(i+2, Ctt); } //Third Dot Color
strip.setPixelColor(i+1, Ct); //Second Dot Color
strip.setPixelColor(i, Co); //Center Dot Color
strip.setPixelColor(i-1, Ct); //Second Dot Color
if(!UsingBar) { strip.setPixelColor(i-2, Ctt); } //Third Dot Color
if(!UsingBar) {
strip.setPixelColor(i-3, strip.Color(0,0,0)); //Clears the dots after the 3rd color
} else {
strip.setPixelColor(i-2, strip.Color(0,0,0)); //Clears the dots after the 2rd color
}
strip.show();
//Serial.println(i); //Used For pixel Count Debugging
delay(Delay);
}
}
So, I need to modify the "wait_t" variable to change the speed it scans across.
I was thinking about using something like measuring the time between pulses using something like this :Time between button press - Programming Questions - Arduino Forum (which I am trying to make be the same as button presses) and then multiple that by 4 to get the total time to get from the beginning to the end of the strip.
so kind of doing this:
int timeAcross = (timeBetweenPulses*4);
int wait_T=timeAcross/PixelCount; //This is the delay between moving back and forth and per pixel
int PixelCount=60;
I feel like there would be better way to approach this though, maybe counting pulses up to 4 and then resetting? (like in thie http://arduino.cc/en/Tutorial/ButtonStateChange