Please Help. Capacitive Touch with Pot controlling LED blink speed

Hello wonderful people!!
I’ve been working on this little experiment of a dorky bell ringer for ages and I’m almost there but totally don’t know how to solve this one last glitch.

I’ve made a capacitive touch sensor where pins 3, 4 and 6 can sense when you touch something conductive (e.g. metal)

I have 3 LED’s called “Bell” on pins 9, 10, 11 that I’m going to hook up to some mosfets and solenoids to hit some bells.

Then I have 3 pots on Apins, 0,1,2

I’m trying to make it so that when you touch:
pin3 it makes the led in pin 9 blink based on the value of pot A0.
pin4 it makes the led in pin 10 blink based on the value of pot A1.
pin6 it makes the led in pin 11 blink based on the value of pot A2.

I’m trying to make them all work independantly and it works, but… the led’s stop blinking after I’ve been touching them for about 1 to 2 mins. The serial monitor is still picking up the capacitive touch data though.
Here is the code below. as you can see I have used the blink without delay millis stuff with state change. I think my long is getting too big and spazzing out the arduino. but again totally no idea and completely lost ;(

Please help if you can, I really wanna make this thing ;(

#include <CapacitiveSensor.h>

CapacitiveSensor   cs_2_3 = CapacitiveSensor(2,3);   
CapacitiveSensor   cs_2_4 = CapacitiveSensor(2,4);        
CapacitiveSensor   cs_5_6 = CapacitiveSensor(5,6);               

int threshold1 = 100;
int threshold2 = 100;
int threshold3 = 100;

int POT1 = A0;
int POT2 = A1;
int POT3 = A2;

int POTval1;
int POTval2;
int POTval3;

int bell1 = 9;
int bell2 = 10;
int bell3 = 11;

int bell1State = LOW;
int bell2State = LOW;
int bell3State = LOW;

int lastChange;

void setup()                    
{
   Serial.begin(9600);
   pinMode(bell1, OUTPUT);
   pinMode(bell2, OUTPUT);
   pinMode(bell3, OUTPUT);
   digitalWrite(bell1, bell1State);
   digitalWrite(bell2, bell2State);
   digitalWrite(bell3, bell3State);
}

void loop()                    
{
    long total1 =  cs_2_3.capacitiveSensor(30);
    long total2 =  cs_2_4.capacitiveSensor(30);
    long total3 =  cs_5_6.capacitiveSensor(30);

POTval1 = map(analogRead(POT1), 0, 1023, 0, 500);
if (total1 > threshold1) {
  if (lastChange + POTval1 <= millis()) 
  {
       bell1State = !bell1State; // invert led's state
       lastChange = millis();  // ledpin state changed NOW
       digitalWrite(bell1, bell1State);
  }
} else {
  digitalWrite(bell1, LOW);
}

   POTval2 = map(analogRead(POT2), 0, 1023, 0, 500);
if (total2 > threshold2) {
  if (lastChange + POTval2 <= millis()) 
  {
       bell2State = !bell2State; // invert led's state
       lastChange = millis();  // ledpin state changed NOW
       digitalWrite(bell2, bell2State);
  }
} else {
  digitalWrite(bell2, LOW);
}

POTval3 = map(analogRead(POT3), 0, 1023, 0, 500);
if (total3 > threshold3) {
 if (lastChange + POTval3 <= millis()) 
  {
       bell3State = !bell3State; // invert led's state
       lastChange = millis();  // ledpin state changed NOW
       digitalWrite(bell3, bell3State);
  }
} else {
  digitalWrite(bell3, LOW);
}

Serial.print("\t"); 
 Serial.print(total1);                  // print sensor output 1
 Serial.print("\t");
 Serial.print(total2);                  // print sensor output 2
  Serial.print("\t");
  Serial.println(total3);                // print sensor output 3
delay(10);                             // arbitrary delay to limit data to serial port 
}

I’m trying to make it so that when you touch:
pin3 it makes the led in pin 9 blink based on the value of pot A0.

The first thing taught in How To Write Requirements 101 is to put your hands in your pockets. Handwaving has NO place in writing requirements. “Based on the value of pot A0” doesn’t mean squat. It is NOT something that can be translated into code without making a lot of assumptions.

Before posting code, using Tools + Auto Format will make us like you better.

I think my long is getting too big and spazzing out the arduino.

I think you have no idea what you are talking about, and certain terms in that statement are considered offensive here.

I really don’t understand why you read data from all three capacitive sensors at once, and then read data from the potentiometer pins one at a time. I don’t understand why you read some values and then sometime later print them. It generally makes more sense to print the values as you read them.

Think about how YOU would blink three LEDs independently. How many times do you need to keep track of? 1? or 3?

I’d recommend, too, that you look at the documentation for millis(). What size value does it return? Given that the function returns the number of milliseconds since the Arduino started, think about how long it will take until the number won’t fit in a byte, an int, a long, an unsigned int, and an unsigned long. Then, think about which type you want to use.