02-12-2022, 22:36
Czy ten kod odpali pin 5 jako przerwanie ?
#include "PinChangeInterrupt.h"
#define INTERRUPT_PIN 5;
int flowPin = 5;
double flowRate;
volatile int count;
void setup()
{
Serial.begin(9600);
pinMode(flowPin, INPUT);
attachPinChangeInterrupt(digitalPinToChangeInterrupt(5),Flow, CHANGE);
}
void loop()
{
count = 0;
interrupsts;
delay (1000);
noInterrupts();
flowRate = flowRate *60;
flowrate = flowRate / 1000;
Serial.println (flowRate);
}
void Flow()
{
count++
}
#include "PinChangeInterrupt.h"
#define INTERRUPT_PIN 5;
int flowPin = 5;
double flowRate;
volatile int count;
void setup()
{
Serial.begin(9600);
pinMode(flowPin, INPUT);
attachPinChangeInterrupt(digitalPinToChangeInterrupt(5),Flow, CHANGE);
}
void loop()
{
count = 0;
interrupsts;
delay (1000);
noInterrupts();
flowRate = flowRate *60;
flowrate = flowRate / 1000;
Serial.println (flowRate);
}
void Flow()
{
count++
}