I guess I'm a special needs kind of person. I apologize, interrupts are new to me.
this is what i have now
ERROR CODE
Arduino: 1.8.5 (Windows 10), TD: 1.41, Board: "Teensy 3.2 / 3.1, Serial, 72 MHz, Faster, US English"
SIX:65: error: 'void Dim()' redeclared as different kind of symbol
void Dim () {
^
G:\arduino\SIX\SIX.ino:8:15: note: previous declaration 'volatile byte Dim'
volatile byte Dim; // interupt name
^
SIX: In function 'void setup()':
SIX:33: error: invalid conversion from 'byte {aka unsigned char}' to 'void (*)()' [-fpermissive]
attachInterrupt(digitalPinToInterrupt(dimmerSwitchISR), Dim, FALLING);
^
In file included from F:\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:38:0,
from F:\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:45,
from F:\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:3,
from C:\Users\Landon\AppData\Local\Temp\arduino_build_402341\sketch\SIX.ino.cpp:1:
F:\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:1931:6: note: initializing argument 2 of 'void attachInterrupt(uint8_t, void (*)(), int)'
void attachInterrupt(uint8_t pin, void (*function)(void), int mode);
^
SIX: In function 'void Dim()':
SIX:65: error: 'void Dim()' redeclared as different kind of symbol
void Dim () {
^
G:\arduino\SIX\SIX.ino:8:15: note: previous declaration 'volatile byte Dim'
volatile byte Dim; // interupt name
^
'void Dim()' redeclared as different kind of symbol
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
PROGRAM CODE
volatile byte dimmerSwitchISR = 9; // temporary switch for counter. counter is pwm for led dimmer
byte dimmerCount; // track button press
int 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
int hotPixleValue; // amount of pixles from sensor that are detecting heat
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++;
}