0
I’m using the function attachInterrupt()
in the Arduino Uno to recognize the end of a course of an actuator. Normally test is used with if()
, but the actuator cycle is very fast and the recognition by this means becomes complicated. With this I chose to use attachInterrupt()
, however I do not know if in the case of interruption I should use pull-down resistor in the input. Someone would know me if you have this need?
Currently the system is as in the image.
Piece of code:
attachInterrupt(digitalPinToInterrupt(interruptPin2), EndCourse2, FALLING);
attachInterrupt(digitalPinToInterrupt(interruptPin3), EndCourse3, FALLING);
void EndCourse2()
{
digitalWrite(12,LOW);
btnpressed2=0;
}
void EndCourse3()
{
if(btnpressed2==0)
{
digitalWrite(12,HIGH);
CounterAT2++;
}
btnpressed2=1;
}