Tachometer Controlling ldp 8806 LED Strip

Hi, I am new to Arduino and have been basically trying to understand stuff by lifting bits of code I have found in forums etc and adapting it to my needs.
I have built a simple tachometer with two Hall Effect Sensors which produces an rpm variable which I would like to use to vary an LED sequence:

Here’s the code for the LED Sequence- this works fine - I use a potentiometer to vary the speed of the sequence :

#include "LPD8806.h"
#include "SPI.h"


// Number of RGB LEDs in strand:
int nLEDs = 32;

// Chose 2 pins for output; can be any valid output pins:
int dataPin  = 3;
int clockPin = 4;
int pinState = HIGH;

int curSpot = 0;

// First parameter is the number of LEDs in the strand.  The LED strips
// are 32 LEDs per meter but you can extend or cut the strip.  Next two
// parameters are SPI data and clock pins:
LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);

void setup() {
  // Start up the LED strip

  // Update the strip, to start they are all 'off'

void loop(){

void rainbowChase() {
  // Current spot along the strip to start the rainbow
  int curSpot = 0;
  boolean done=false;
  int   sensorValue = map(analogRead(A0),0,1023,10,200);
  while (!done) {
    // Start by turning all pixels off:
    for(int i=0; i<strip.numPixels(); i++) 
      strip.setPixelColor(i, 0);
    int spot=curSpot;
    // Start setting LEDs and moving "up" the strip
    strip.setPixelColor(spot++, strip.Color(20,0,0)); // Set new pixel 'on'
    strip.setPixelColor(spot++, strip.Color(127,0,0)); // Set new pixel 'on'
    strip.setPixelColor(spot++, strip.Color(0,127,0)); // Set new pixel 'on'
    strip.setPixelColor(spot++, strip.Color(0,0,127)); // Set new pixel 'on'
    strip.setPixelColor(spot++, strip.Color(60,0,127)); // Set new pixel 'on'
    strip.setPixelColor(spot++, strip.Color(15,0,40)); // Set new pixel 'on'
    strip.show();              // Refresh LED states
    if (curSpot > nLEDs)

And here’s the code for the tachometer which also works fine:

// this constant won't change:
const int  buttonPin = 2;    // the pin that the pushbutton is attached to
const int ledPin = 13;       // the pin that the LED is attached to

// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

long curRevTime;            // clock time of the latest pass of the magnet
long prevRevTime;            // clock time of the prior pass of the magnet
const int revTimeout = 1000;      // if no revs in this period, wheel has stopped (ms)

long  revCount = 0;            // number of revolutions we've seen
int   magRPM = 0;  // RPMs of the latest pass (revolution) of the magnet

void setup() {
  // initialize the button pin as a input:
  pinMode(buttonPin, INPUT);
  // initialize the LED as an output:
  pinMode(ledPin, OUTPUT);
  // initialize serial communication:

void loop() {
  // read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);
    if ((millis () - prevRevTime) > revTimeout) {

      // wheel has stopped rotating

      magRPM = 0;


  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button
      // wend from off to on:
     // Serial.println("on");
      //Serial.print("number of button pushes:  ");
       curRevTime = millis ();

      // and see how long it has been since the last revolution

      long thisRev = curRevTime - prevRevTime;
      //Serial.print("thisRev:  ");
       magRPM = 60000 / thisRev;
      Serial.print("magRPM:  ");
   ///raindbowChase();// rainbowChase uses global value of magRPM
      // and remember the interval for the next time

      prevRevTime = curRevTime;
       digitalWrite (ledPin, true);
    else {
      // if the current state is LOW then the button
      // wend from on to off:
      digitalWrite (ledPin, false);
  // save the current state as the last state,
  //for next time through the loop
  lastButtonState = buttonState;


what I would like to be able to do is vary the delay in rainbowchase() function by mapping it to the magRPM global variable which the tachometer produces.

When using the potentiometer it seems that the rainbowChase function is continually reading the analogue input so that turning adjusting the pot has an instant effect on the speed of the sequence.
How do I get rainbowChase function to read the changing magRPM value. ? If I replace the line delay(sensorValue); with delay(magRPM); - I don’t get the same results.
It’s almost like I want the two functions to run concurrently, but I am not sure how to structure my code to achieve this.