Couldnt read from another tab('buzzertime' was not declared in this scope)

hi there....i dont know why this is happen sudenly,because i always succes when i read void xxx() {} from another tab. but when i put new code and this problem happen.if i put all of my program in void loop () {} ,im very confuse,because is to much.so i saparate it into new tab.But when i adding new program sudenly the irrasional problem happen like this.:

C:\Users\ridho\Documents\Arduino\main_menu\main_menu.ino: In function 'void loop()':

main_menu:84:13: error: 'buzzertime' was not declared in this scope

  buzzertime();

             ^

main_menu:85:11: error: 'tampil' was not declared in this scope

    tampil();

           ^

C:\Users\ridho\Documents\Arduino\main_menu\interupt_button.ino: In function 'void interupt()':

interupt_button:7:17: error: 'saatUpDitekan' was not declared in this scope

   saatUpDitekan();

                 ^

interupt_button:8:17: error: 'saatOkDitekan' was not declared in this scope

   saatOkDitekan();

                 ^

interupt_button:9:19: error: 'saatDownDitekan' was not declared in this scope

   saatDownDitekan();

                   ^

interupt_button:10:19: error: 'saatBackDitekan' was not declared in this scope

   saatBackDitekan();

                   ^

nilai_button:2:22: error: a function-definition is not allowed here before '{' token

 void saatUpDitekan() {

                      ^

tampilan_menu:201:1: error: expected '}' at end of input

 }

 ^

Multiple libraries were found for "Adafruit_SSD1306.h"

 Used: C:\Users\ridho\Documents\Arduino\libraries\Adafruit_SSD1306

 Not used: C:\Users\ridho\Documents\Arduino\libraries\Adafruit_SSD1306_Wemos_Mini_OLED

 Not used: C:\Users\ridho\Documents\Arduino\libraries\Adafruit_SSD1306-master

Using library SPI at version 1.0 in folder: C:\Users\ridho\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.3-rc3\libraries\SPI 

Using library Wire at version 1.0.1 in folder: C:\Users\ridho\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.3-rc3\libraries\Wire 

Using library Adafruit_SSD1306 at version 2.4.4 in folder: C:\Users\ridho\Documents\Arduino\libraries\Adafruit_SSD1306 

Using library arduino_696289 at version 1.10.10 in folder: C:\Users\ridho\Documents\Arduino\libraries\arduino_696289 

Using library Adafruit_BusIO at version 1.7.2 in folder: C:\Users\ridho\Documents\Arduino\libraries\Adafruit_BusIO 

exit status 1

'buzzertime' was not declared in this scope


this my code:

#define RXp2 16
#define TXp2 17
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 lcd(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
#include "logo_pens.h"
#include "xiaomi_logo.h"
#define btnUp   12
#define btnOk   14
#define btnDown 27
#define btnBack 26
#define Buzz 25
///ini program esp
//#include <WiFi.h>
//#include "CTBot.h"
////variabel untuk bot telegram
//CTBot myBot;
////konfigurasi koneksi ke wifi
//const char* ssid = "Ngaji sam";
//const char* pass = "dikunci1";
////variabel token id telegram
//String token = "1779766605:AAE74wbTMW4D70FvmhKs0fXZJKKJDVii13k";
//const int id = 809915526;
String dataIn;
String dt[10];
int i;
int rpm = 0;
float cadence = 0;
//float Odo = 0;
//float Trip = 0;
float Speed = 0;
float torsi = 0;
float batt = 0;
//float TripNow = 0;
//float OdoNow = 0.0;
bool parsing=false;
float keliling = 1.57;

//define my buzzer
unsigned long interval=500; // the time we need to wait
unsigned long previousMillis=0; // millis() returns an unsigned long.
  
bool ledState = true; // state variable for the buzzer
/////////////////////
bool statusBtnUp   = false;
bool statusBtnOk   = false;
bool statusBtnDown = false;
bool statusBtnBack = false;

bool statusAkhirBtnUp   = false;
bool statusAkhirBtnOk   = false;
bool statusAkhirBtnDown = false;
bool statusAkhirBtnBack = false;

bool UP   = false;
bool _OK   = false;
bool DOWN = false;
bool BACK = false;

int halaman  = 1;
int menuItem = 1;  
void setup() {
  //my buzzer
 pinMode(25, OUTPUT);
 digitalWrite(25, ledState);
 ////---------------------------////
 Serial.begin(115200);
  lcd.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  lcd.clearDisplay();
 
  lcd.drawBitmap(0, 0, epd_bitmap_penpens, SCREEN_WIDTH, SCREEN_HEIGHT, SSD1306_WHITE);
  lcd.display();
  delay(5000);
  lcd.display();
   AllPixels();

}
  
void loop() {
 buzzertime();
   tampil();
  interupt();
}

buzzer void code:

void buzzertime(){
 unsigned long currentMillis = millis(); // grab current time
  
 // check if "interval" time has passed (1000 milliseconds)
 if ((unsigned long)(currentMillis - previousMillis) >= interval) {
   
   ledState = false; // "toggles" the state
   digitalWrite(25, ledState); // sets the LED based on ledState
   // save the "current" time
   previousMillis = millis();
 } 
}


screen oled display:

void tampil() {
////////////////isi hal 1//////////////////
  if (halaman == 1) {
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(30, 0);
//    lcd.print("E-BIKE PENS");

    if (menuItem == 1) {
      lcd.setCursor(30, 0);
      lcd.setTextColor(WHITE);
      lcd.print(" ▲");
    } else {
      lcd.setCursor(30, 0);
      lcd.setTextColor(WHITE);
      lcd.print(" △ ");
    }

    

    if (menuItem == 2) {
      lcd.setCursor(0, 30);
      lcd.setTextColor(WHITE);
      lcd.print("▼");
    } else {
      lcd.setCursor(0, 30);
      lcd.setTextColor(WHITE);
      lcd.print("  ▽");
    }

  } 
   ///////////////isi halaman 2-3////////////////
  else if (halaman == 2) 
  {
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 0);
//    lcd.println("kecepatan");
//    lcd.println(Speed);
//    lcd.print("Km/h");
    /////
    if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
           kecepatan();
           delay (500);
           parsing=false;
           dataIn="";
     }
    ////
  } 
  else if (halaman == 3) 
  {
//    lcd.clearDisplay();
//    lcd.setTextSize(2);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(10, 15);
//    lcd.print("VOLTASE");
//    lcd.setCursor(30, 35);
//    lcd.print("VOLT");
/////
    if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          voltbat();
           delay (500);
           parsing=false;
           dataIn="";
     }
    ////
  } 
  else if (halaman == 4) 
  {
//    lcd.clearDisplay();
//    lcd.setTextSize(2);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 25);
//    lcd.print("Arus bat");
if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          arusbatt();
           delay (500);
           parsing=false;
           dataIn="";
     }
  }

  ////isi halaman 5//////////
  if (halaman == 5) 
  {
   lcd.clearDisplay();
    lcd.setTextSize(1);
    lcd.setTextColor(WHITE);
    lcd.setCursor(30, 0);
    lcd.print("menu 2");

    if (menuItem == 5) 
    {
      lcd.setCursor(5, 17);
      lcd.setTextColor(WHITE);
      lcd.print("> nilai torsi");
    } else {
      lcd.setCursor(5, 17);
      lcd.setTextColor(WHITE);
      lcd.print("  torsi sepeda ");
    }

    if (menuItem == 6) 
    {
      lcd.setCursor(5, 27);
      lcd.setTextColor(WHITE);
      lcd.print("> cadance");
    } else 
    {
      lcd.setCursor(5, 27);
      lcd.setTextColor(WHITE);
      lcd.print("  nilai cadance");
    }
  }
   else if (halaman == 6) 
   {
    
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 25);
//    lcd.print("torsi sepeda");

if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          torsipedal();
           delay (500);
           parsing=false;
           dataIn="";
     }

  }
   else if (halaman == 7) {
    
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 25);
//    lcd.print("cadance ");
if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          cadance();
           delay (500);
           parsing=false;
           dataIn="";
     }

  }

  lcd.display();
}

my interupt program:

void  interupt(){
  statusBtnUp   = digitalRead(btnUp);
  statusBtnOk   = digitalRead(btnOk);
  statusBtnDown = digitalRead(btnDown);
  statusBtnBack = digitalRead(btnBack);

  saatUpDitekan();
  saatOkDitekan();
  saatDownDitekan();
  saatBackDitekan();

  //  untuk button up hal 1
  if (UP && halaman == 1) {
    UP = false;
    menuItem --;
    if (menuItem < 1)menuItem = 2; 
  }
  //i=untuk button up hal 5
  if (UP && halaman == 2) {
    UP = false;
    menuItem --;
    if (menuItem < 3)menuItem = 4; 
  }
  if (UP && halaman == 3) {
    UP = false;
    menuItem --;
    if (menuItem < 5)menuItem = 6; 
  }
  if (UP && halaman == 4) {
    UP = false;
    menuItem --;
    if (menuItem < 7)menuItem = 8; 
  }
  
  
  //untuk button down hal 1
  if (DOWN && halaman == 1) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 2)menuItem = 1; 
  }
  //button down hal 2
  if (DOWN && halaman == 2) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 4)menuItem = 3;
  }
    //button down hal 3
  if (DOWN && halaman == 3) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 6)menuItem = 5;
  }
   //button down hal 4
  if (DOWN && halaman == 4) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 8)menuItem = 7;
  //  untuk button ok
  if (_OK) {
    _OK = false;
    if (halaman == 1 && menuItem == 1) {
      halaman = 4;
      if (halaman == 1 && menuItem == 2) {
      halaman = 2;
    } else if (halaman == 2 && menuItem == 3) {
      halaman = 1;
    } else if (halaman == 2 && menuItem == 4) {
      halaman = 5;
    } else if (halaman == 3 && menuItem == 5) {
      halaman = 2;
    }
    else if (halaman == 3 && menuItem == 6) {
      halaman = 4;
    }
    else if (halaman == 4 && menuItem == 7) {
      halaman = 3;
    }
    else if (halaman == 4 && menuItem == 8) {
      halaman = 1;
    }
  }

  //  untuk button back
  if (BACK) {
    BACK = false;
    if (halaman == 2) {
      halaman = 1;
    }
    if (halaman ==3){
      halaman = 2;
    }
    if (halaman == 4){
      halaman = 3;
      
    }
  }
}

  Serial.println(menuItem);
  delay(100);
}
#define RXp2 16
#define TXp2 17
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 lcd(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
#include "logo_pens.h"
#include "xiaomi_logo.h"
#define btnUp   12
#define btnOk   14
#define btnDown 27
#define btnBack 26
#define Buzz 25
///ini program esp
//#include <WiFi.h>
//#include "CTBot.h"
////variabel untuk bot telegram
//CTBot myBot;
////konfigurasi koneksi ke wifi
//const char* ssid = "Ngaji sam";
//const char* pass = "dikunci1";
////variabel token id telegram
//String token = "1779766605:AAE74wbTMW4D70FvmhKs0fXZJKKJDVii13k";
//const int id = 809915526;
String dataIn;
String dt[10];
int i;
int rpm = 0;
float cadence = 0;
//float Odo = 0;
//float Trip = 0;
float Speed = 0;
float torsi = 0;
float batt = 0;
//float TripNow = 0;
//float OdoNow = 0.0;
bool parsing=false;
float keliling = 1.57;

//define my buzzer
unsigned long interval=500; // the time we need to wait
unsigned long previousMillis=0; // millis() returns an unsigned long.
  
bool ledState = true; // state variable for the buzzer
/////////////////////
bool statusBtnUp   = false;
bool statusBtnOk   = false;
bool statusBtnDown = false;
bool statusBtnBack = false;

bool statusAkhirBtnUp   = false;
bool statusAkhirBtnOk   = false;
bool statusAkhirBtnDown = false;
bool statusAkhirBtnBack = false;

bool UP   = false;
bool _OK   = false;
bool DOWN = false;
bool BACK = false;

int halaman  = 1;
int menuItem = 1;  
void setup() {
  //my buzzer
 pinMode(25, OUTPUT);
 digitalWrite(25, ledState);
 ////---------------------------////
 Serial.begin(115200);
  lcd.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  lcd.clearDisplay();
 
  lcd.drawBitmap(0, 0, epd_bitmap_penpens, SCREEN_WIDTH, SCREEN_HEIGHT, SSD1306_WHITE);
  lcd.display();
  delay(5000);
  lcd.display();
   AllPixels();

}
  
void loop() {
 buzzertime();
   tampil();
  interupt();
}

void buzzertime(){
 unsigned long currentMillis = millis(); // grab current time
  
 // check if "interval" time has passed (1000 milliseconds)
 if ((unsigned long)(currentMillis - previousMillis) >= interval) {
   
   ledState = false; // "toggles" the state
   digitalWrite(25, ledState); // sets the LED based on ledState
   // save the "current" time
   previousMillis = millis();
 } 
}

void tampil() {
////////////////isi hal 1//////////////////
  if (halaman == 1) {
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(30, 0);
//    lcd.print("E-BIKE PENS");

    if (menuItem == 1) {
      lcd.setCursor(30, 0);
      lcd.setTextColor(WHITE);
      lcd.print(" ▲");
    } else {
      lcd.setCursor(30, 0);
      lcd.setTextColor(WHITE);
      lcd.print(" △ ");
    }

    

    if (menuItem == 2) {
      lcd.setCursor(0, 30);
      lcd.setTextColor(WHITE);
      lcd.print("▼");
    } else {
      lcd.setCursor(0, 30);
      lcd.setTextColor(WHITE);
      lcd.print("  ▽");
    }

  } 
   ///////////////isi halaman 2-3////////////////
  else if (halaman == 2) 
  {
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 0);
//    lcd.println("kecepatan");
//    lcd.println(Speed);
//    lcd.print("Km/h");
    /////
    if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
           kecepatan();
           delay (500);
           parsing=false;
           dataIn="";
     }
    ////
  } 
  else if (halaman == 3) 
  {
//    lcd.clearDisplay();
//    lcd.setTextSize(2);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(10, 15);
//    lcd.print("VOLTASE");
//    lcd.setCursor(30, 35);
//    lcd.print("VOLT");
/////
    if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          voltbat();
           delay (500);
           parsing=false;
           dataIn="";
     }
    ////
  } 
  else if (halaman == 4) 
  {
//    lcd.clearDisplay();
//    lcd.setTextSize(2);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 25);
//    lcd.print("Arus bat");
if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          arusbatt();
           delay (500);
           parsing=false;
           dataIn="";
     }
  }

  ////isi halaman 5//////////
  if (halaman == 5) 
  {
   lcd.clearDisplay();
    lcd.setTextSize(1);
    lcd.setTextColor(WHITE);
    lcd.setCursor(30, 0);
    lcd.print("menu 2");

    if (menuItem == 5) 
    {
      lcd.setCursor(5, 17);
      lcd.setTextColor(WHITE);
      lcd.print("> nilai torsi");
    } else {
      lcd.setCursor(5, 17);
      lcd.setTextColor(WHITE);
      lcd.print("  torsi sepeda ");
    }

    if (menuItem == 6) 
    {
      lcd.setCursor(5, 27);
      lcd.setTextColor(WHITE);
      lcd.print("> cadance");
    } else 
    {
      lcd.setCursor(5, 27);
      lcd.setTextColor(WHITE);
      lcd.print("  nilai cadance");
    }
  }
   else if (halaman == 6) 
   {
    
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 25);
//    lcd.print("torsi sepeda");

if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          torsipedal();
           delay (500);
           parsing=false;
           dataIn="";
     }

  }
   else if (halaman == 7) {
    
//    lcd.clearDisplay();
//    lcd.setTextSize(1);
//    lcd.setTextColor(WHITE);
//    lcd.setCursor(25, 25);
//    lcd.print("cadance ");
if(Serial2.available()>0)
     {
           char inChar = (char)Serial2.read();
           dataIn += inChar;
           if (inChar == '\n') 
           {
            parsing = true;
            }
     }
     if(parsing)
     {
          cadance();
           delay (500);
           parsing=false;
           dataIn="";
     }

  }

  lcd.display();
}

void  interupt(){
  statusBtnUp   = digitalRead(btnUp);
  statusBtnOk   = digitalRead(btnOk);
  statusBtnDown = digitalRead(btnDown);
  statusBtnBack = digitalRead(btnBack);

  saatUpDitekan();
  saatOkDitekan();
  saatDownDitekan();
  saatBackDitekan();

  //  untuk button up hal 1
  if (UP && halaman == 1) {
    UP = false;
    menuItem --;
    if (menuItem < 1)menuItem = 2; 
  }
  //i=untuk button up hal 5
  if (UP && halaman == 2) {
    UP = false;
    menuItem --;
    if (menuItem < 3)menuItem = 4; 
  }
  if (UP && halaman == 3) {
    UP = false;
    menuItem --;
    if (menuItem < 5)menuItem = 6; 
  }
  if (UP && halaman == 4) {
    UP = false;
    menuItem --;
    if (menuItem < 7)menuItem = 8; 
  }
  
  
  //untuk button down hal 1
  if (DOWN && halaman == 1) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 2)menuItem = 1; 
  }
  //button down hal 2
  if (DOWN && halaman == 2) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 4)menuItem = 3;
  }
    //button down hal 3
  if (DOWN && halaman == 3) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 6)menuItem = 5;
  }
   //button down hal 4
  if (DOWN && halaman == 4) {
    DOWN = false;
    menuItem ++;
    if (menuItem > 8)menuItem = 7;
  //  untuk button ok
  if (_OK) {
    _OK = false;
    if (halaman == 1 && menuItem == 1) {
      halaman = 4;
      if (halaman == 1 && menuItem == 2) {
      halaman = 2;
    } else if (halaman == 2 && menuItem == 3) {
      halaman = 1;
    } else if (halaman == 2 && menuItem == 4) {
      halaman = 5;
    } else if (halaman == 3 && menuItem == 5) {
      halaman = 2;
    }
    else if (halaman == 3 && menuItem == 6) {
      halaman = 4;
    }
    else if (halaman == 4 && menuItem == 7) {
      halaman = 3;
    }
    else if (halaman == 4 && menuItem == 8) {
      halaman = 1;
    }
  }

  //  untuk button back
  if (BACK) {
    BACK = false;
    if (halaman == 2) {
      halaman = 1;
    }
    if (halaman ==3){
      halaman = 2;
    }
    if (halaman == 4){
      halaman = 3;
      
    }
  }
}

  Serial.println(menuItem);
  delay(100);
}
}

Give this one a try
Btw you don't need different "*tabs" to organize your code
You can separate different methods of your code this way also

Yes, I still have many other programs that I haven't added yet...so i have separate it,,before its work,but i make new one,and this problem happen..so how?

As far as the compiler is concerned, it combines all of the .ino files that is each tab before compiling. If everything in the tabs are functions, then it will compile as if it were a single large file.

I like tabs. It makes my programs a lot easier to understand, and the functions that are tabs are mor portable between projects.

suddenly accidentally I know guys, that there is a function that I have not added a "}" sign, namely in void interrupt(){ im forget to put a sign"}"

:scream: :scream: :pensive: :pensive:

thanks about your opinion brother..its very helpfull for me!!!! it was great!!! have a nice day!! :slightly_smiling_face: :+1: :+1: :+1: :+1: :point_up: