Hi, I have some problem with build my project. I have tried to make interrupt with help of an attachInterrupt function, but compiler is writing “src/main.cpp:24:22: error: ‘myInter’ was not declared in this scope”. But i have function myInter(). The code is bellow:
#include <Arduino.h>
#define TIME_START 0
unsigned long period_time = 10000;
unsigned long width_time = 5000;
//рабочие переменные
unsigned long period_timer;
unsigned long width_timer;
bool flag_timer = false;
volatile bool flag = false;
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(9, OUTPUT);
attachInterrupt(0, myInter, FALLING);
period_timer = millis();
}
void loop() {
if(flag == true) {
if(millis() - period_timer > period_time) {
period_timer = millis();
width_timer = millis();
flag_timer = true;
digitalWrite(9, HIGH);
}
if((millis() - width_timer > width_time) && flag_timer == true) {
flag_timer = false;
if(TIME_START) period_timer = millis();
digitalWrite(9, LOW);
}
flag = false;
}
}
void myInter() {
flag = true;
}
But, in Arduino IDE all is OK.