no, it didn't seem to fix the issue.
here is my full code as requested
/* infra red proximity detector by, Landon Williams
teensy 3.2 and AMG8833
*/
const byte dimmerSwitchISR = 9; // temporary switch for counter. counter is pwm for led dimmer
volatile byte dimmerCount; // track button press
byte dimmerValue; // set PWM with counter 0-3
//volatile byte Dim; // interupt name
byte ledRred = 3; // red LED right side
byte ledRyellow = 4; // yellow LED right side
byte ledLyellow = 5; // yellow LED left side
byte ledLred = 6; // red LED left side
const byte irA = 21; // middle sensor, address selection
const byte irB = 22; // right side sensor, address selection
const byte irC = 23; // left side sensor, address selection
int battSensor = A0; // read battery voltage, pin 14 on teensy
void setup() {
// put your setup code here, to run once:
// pinMode(dimmerSwitchISR,INPUT_PULLUP);
pinMode(ledRred, OUTPUT);
pinMode(ledRyellow, OUTPUT);
pinMode(ledLyellow, OUTPUT);
pinMode(ledLred, OUTPUT);
pinMode(irA, OUTPUT);
pinMode(irB, OUTPUT);
pinMode(irC, OUTPUT);
dimmerCount = 1;
attachInterrupt(digitalPinToInterrupt(dimmerSwitchISR), Dim, FALLING);
}
void loop() {
// put your main code here, to run repeatedly:
/*if (digitalRead(dimmerSwitch) == LOW){
//dimmerCount++;
}*/
if (dimmerCount == 3) {
dimmerCount = 0;
}
if (dimmerCount == 0) {
dimmerValue = 40;
}
if (dimmerCount == 1) {
dimmerValue = 115;
}
if (dimmerCount == 2) {
dimmerValue = 255;
}
analogWrite(ledLyellow, dimmerValue);
analogWrite(ledLred, dimmerValue);
analogWrite(ledRred, dimmerValue);
analogWrite(ledRyellow, dimmerValue);
delay(160);
}
void Dim () {
dimmerCount++;
}