cattledog:
If you want to time your interrupt counts do not use delay. Use the "blink without delay" millis() timer approach. Only disable interrupts briefly to read data. Software Serial requires interrupts to be enabled. I would suggest that you read Nick Gammon's tutorial on interrupts Gammon Forum : Electronics : Microprocessors : InterruptsHere's an example of timing an interrupt count
volatile unsigned long count = 0;
unsigned long copyCount = 0;
unsigned long lastRead = 0;
unsigned long interval = 1000;//one second
void setup()
{
Serial.begin(115200);
Serial.println("start...");
pinMode(2,INPUT_PULLUP);
attachInterrupt(0, isrCount, RISING); //interrupt signal to pin 2
}
void loop()
{
if (millis() - lastRead >= interval) //read interrupt count every second
{
lastRead += interval;
// disable interrupts,make copy of count,reenable interrupts
noInterrupts();
copyCount = count;
count = 0;
interrupts();
Serial.println(copyCount);
}
}
void isrCount()
{
count++;
}
I was able to get this to operate how I wanted. I was able to tweak the code you sent above and it worked great.
Also the link was very informative as well.
THANK YOU
THANK YOU
THANK YOU!!!