I’ve been trying to fix this code for the second day, but I can’t . That’s why I turned to you. I have a button which, if I hold it down for a long time (over 5 s), the setting is switched on. And then with short presses (under 5 s) I would switch modes. And if I held the button again for 5 seconds, the setting would end. Turning the setting on and off goes but switching there is some problem.
#define butt 3
long lastPress;
long TimePress;
boolean stateButt= LOW;
boolean SettBegin = LOW;
int pozition;
void setup() {
pinMode(butt, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(butt), Sett, CHANGE);
Serial.begin(9600);
}
Topic moved here as its original location was not appropriate
Please follow the advice on posting code given in posting code
In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless