I've developed a code that uses interrupts in Arduino Uno. I am trying to post the data to a web server, so I am using an Ethernet Shield, but it seems that the Ethernet Shield can't detect those interrupts. Do you know if the Ethernet shield support interrupts?
See the code:
Code: Select all
int rpm;
unsigned long previTemps = 0; // Variable per comparar temps previ i actual
long interval = 60000; // interval entre operacions (ms)
void setup()
{
Serial.begin(9600);
attachInterrupt(0, rpm_cinta, RISING);
rpm = 0;
}
void loop()
{
unsigned long actualTemps = millis();
if(actualTemps - previTemps > interval) {
previTemps = actualTemps;
Serial.print("Rpm al min= ");
Serial.println(rpm);
rpm=0; // Reset rpm
}
}
void rpm_cinta()
{
rpm++; //Add rpm
//Serial.print("Nova rpm! ");
Serial.println(rpm);
}
Anton