Redeclared as different kind of symbol ошибка arduino

Offline

Зарегистрирован: 06.10.2019

//возможно нужно было кидать в раздел для новичков

написал код с массивом в котором храню текст , а текст хранится только в String  и еще вроде в char , поэтому поставил тип массива String , но при компиляции выдает — redeclared as different kind of symbol , закинул в переводчик — переоформленный как другой вид символа , насколько я понял он не считает мой текст за  String , хочется в ответе конкретного что не так  и как исправить. спасибо.

#include <iarduino_OLED.h>    // Подключаем библиотеку iarduino_OLED.
iarduino_OLED myOLED(0x3C);   // адрес для работы с дисплеем по I2c
#define CLK 2 //пин энкодера
#define DT 3//пин энкодера
#define SW 4//пин энкодера
#include "GyverEncoder.h" //энкодер
Encoder enc(CLK, DT, SW);//подключаем энкодер
String menu []= {"добавить канал","удалить канал","удалить все каналы","инф. канала"};
byte oldP=1;
byte nowP=0;
extern uint8_t SmallFontRus[];        

void setup() {
  // put your setup code here, to run once:
  myOLED.begin();  //  инициализация работы с дисплеем
Serial.begin(9600);
  attachInterrupt(0, isrCLK, CHANGE);    // прерывание на 2 пине! CLK у энка
  attachInterrupt(1, isrDT, CHANGE);   // прерывание на 3 пине! DT у энка
  myOLED.setFont(SmallFontRus);   
   myOLED.setCoding(TXT_UTF8);   
}
void isrCLK() {
  enc1.tick();  // отработка в прерывании
}
void isrDT() {
  enc1.tick();  // отработка в прерывании
}


void loop() {
  // put your main code here, to run repeatedly:
   myOLED.print("loop"], OLED_C, 31);  
 while (1){
if (enc.isHolded()==1){
   myOLED.clrScr();    
  menu ();
}
 }
}

void menu () {
  if (oldP>nowP){
    myOLED.invText();  
    myOLED.print(menu [nowP], OLED_C, 31);   
   
  }
  else {
    myOLED.invText(false);     
  myOLED.print(menu [oldP], OLED_C, 31); 
  }
// 2 строчка
    if (oldP<nowP){
    myOLED.invText();  
    myOLED.print(menu [nowP], OLED_C, 31);  
     myOLED.invText(false);   
  }
  else {
    myOLED.invText(false);     
  myOLED.print(menu [oldP], OLED_C, 47); 
  }
  for (byte i=0 ;i<255;i++){
    delay (6);
    if (isRight()==1){
oldP=nowP;
nowP++;
if (nowP>menu.count){
  nowP=0
    }
    }
        if (isLeft()==1){
oldP=nowP;
if (nowP==0){
  nowP=menu.count;
    }
    else{
nowP=nowP-1;
    }

        }  
           if (isHolded()==1){
             myOLED.clrScr();
     loop() ;
   }
   
}
}
loop() ;
}

Arduino Forum

Loading

I’m currently working on a school project. I want the servo to move according to the number of coins selected. I keep getting the error » ‘void servoOne()’ redeclared as different kind of symbol » I know this has been asked but I’m not sure how to fix this.

Here is my code.

#include <LiquidCrystal.h>
#include <Keypad.h>
#include <Servo.h>

Servo servoOne;

String sharp="";
int piso=0;
int lima=0;
int sampu=0;

String input="";
String remlast = "";

LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);//RS,EN,D4,D5,D6,D7


const byte Rows= 4; //number of rows on the keypad i.e. 4
const byte Cols= 3; //number of columns on the keypad i,e, 3

//we will definne the key map as on the key pad:

char keymap[Rows][Cols]={
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};

byte rPins[Rows]= {3,4,5,6}; //Rows 0 to 3
byte cPins[Cols]= {7,8,9}; //Columns 0 to 2

Keypad kpd= Keypad(makeKeymap(keymap), rPins, cPins, Rows, Cols);

void setup() {
  // put your setup code here, to run once:
lcd.begin(20,4);
servoOne.attach(10);
}

void loop() {
    char key2 = kpd.getKey();


  if (key2 != NO_KEY)
     { 
       lcd.print(key2);

       if (sharp == "")
       {
          input+=key2;
          remlast = input;
          remlast.replace("*","");
            remlast.replace("#","");
            piso = remlast.toInt();
       }
       else if (sharp == "five")
       {
          input+=key2;
          remlast = input;
          remlast.replace("*","");
            remlast.replace("#","");
            lima = remlast.toInt();
       }
       else if (sharp == "ten")
       {
          input+=key2;
          remlast = input;
          remlast.replace("*","");
            remlast.replace("#","");
            sampu = remlast.toInt();
       }

      if(key2=='*' && sharp!=NULL)
      {
        lcd.rightToLeft();
        sharp="";
        piso=0;
        lima=0;
        sampu=0;
        input="";
        remlast="";
      }  

      if (sharp=="ten" && key2=='#')
      {
        sharp = "out";
        lcd.clear();
        lcd.print(piso);
        lcd.print(lima);
        lcd.print(sampu);
        servoOne();
      }

     else if (sharp=="five" && key2=='#')
       {
          lcd.clear();
          lcd.print("10-peso=");
          lcd.setCursor(0,1);
          lcd.print("(*)Erase  (#)Enter");
          lcd.setCursor(8,0);  
          sharp="ten";  
          input = 0;      
       }

     else if (key2=='#')
      {
        lcd.clear();
        lcd.print("5-peso=");
        lcd.setCursor(0,1);
        lcd.print("(*)Erase  (#)Enter");
        lcd.setCursor(7,0); 
        sharp="five";
        input = 0;

      }
      if (key2=='*')
      {
        lcd.clear();
        lcd.print("1-peso=");
        lcd.setCursor(0,1);
        lcd.print("(*)Erase  (#)Enter");
        lcd.setCursor(7,0); 
      }

      }
   }

//--------------------SERVO ONE--------------------//
void servoOne()
{
  servoOne.write(70);
  delay(10);
  while(piso>0)
  {
    int x = piso;
    while(x>0)
    {
      servoOne.write(170);
      delay(200);
      servoOne.write(40);
      delay(200);
      x--;
    }
  }
}

Been struggling with this for a few days and I suspect that i have several issues but I cannot find them.

Project: Need a serial count that counts by 5-50 and a button interrupt should trigger a display of the current time and then continue counting.

Issue: Cannot complete compiling because my «void rtcTime()» is saying I am redeclared as different kind of symbol.

Any help the community can provide is greatly appreciated.

Code:

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include "RTClib.h"
#include <Wire.h>


RTC_DS1307 rtc;

int count = 5;
int rtcTime = 0;
int pin = 0;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup (){

  pinMode(2, INPUT);

  rtc.begin();

  while (!Serial); // for Leonardo/Micro/Zero

  Serial.begin(9600);

  if (! rtc.begin()) {
   Serial.println("Couldn't find RTC");
   while (1);
      }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
     }

     attachInterrupt(pin, rtcTime, RISING);
} 


void loop()
{
  // Count X5 on Serial Monitor

  if (count > 50)
    {
    count=5;
    Serial.println(count);
    }

   else if (count<50)
    {
    count=count+5;
    Serial.println(count);
    delay(1000);
     }
  }

void rtcTime() {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    }

Error Message:

Arduino: 1.8.10 (Mac OS X), Board: «Arduino/Genuino Mega or Mega 2560,
ATmega2560 (Mega 2560)»

ds1307_workingCopy_Mod5:60:14: error: ‘void rtcTime()’ redeclared as
different kind of symbol void rtcTime() {
^ /Users/kiko/Documents/Arduino/ds1307_workingCopy_Mod5/ds1307_workingCopy_Mod5.ino:9:5:
note: previous declaration ‘int rtcTime’ int rtcTime = 0;
^~~~~~~ /Users/kiko/Documents/Arduino/ds1307_workingCopy_Mod5/ds1307_workingCopy_Mod5.ino:
In function ‘void setup()’:
/Users/kiko/Documents/Arduino/ds1307_workingCopy_Mod5/ds1307_workingCopy_Mod5.ino:38:42:
warning: invalid conversion from ‘int’ to ‘void ()()’ [-fpermissive]
attachInterrupt(pin, rtcTime, RISING);
^ In file included from sketch/ds1307_workingCopy_Mod5.ino.cpp:1:0:
/Users/kiko/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:150:6:
note: initializing argument 2 of ‘void attachInterrupt(uint8_t, void
(
)(), int)’ void attachInterrupt(uint8_t, void (*)(void), int mode);
^~~~~~~~~~~~~~~ /Users/kiko/Documents/Arduino/ds1307_workingCopy_Mod5/ds1307_workingCopy_Mod5.ino:
In function ‘void rtcTime()’: ds1307_workingCopy_Mod5:60:14: error:
‘void rtcTime()’ redeclared as different kind of symbol void
rtcTime() {
^ /Users/kiko/Documents/Arduino/ds1307_workingCopy_Mod5/ds1307_workingCopy_Mod5.ino:9:5:
note: previous declaration ‘int rtcTime’ int rtcTime = 0;
^~~~~~~ Multiple libraries were found for «RTClib.h» Used: /Users/kiko/Documents/Arduino/libraries/RTClib-1.3.3 Not used:
/Users/kiko/Documents/Arduino/libraries/RTCLib_by_NeiroN Multiple
libraries were found for «Wire.h» Used:
/Users/kiko/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
exit status 1 ‘void rtcTime()’ redeclared as different kind of symbol

This report would have more information with «Show verbose output
during compilation» option enabled in File -> Preferences.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username
Email Address
Password

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Понравилась статья? Поделить с друзьями:
  • Rdr 2 ошибка при запуске приложения 0xc0000005
  • Razer synapse ошибка при установке
  • Radmir ошибка при проверке файлов
  • Radmir rp ошибка при установке
  • Radeonsoftware exe системная ошибка libegl dll