Go Down

Topic: 'toCharArray' was not declared in this scope (Read 95 times) previous topic - next topic

CarlosAdriano

Ao usar a função toCharArray dá esse erro. Acredito que seja porque está faltando a biblioteca, mas não sei qual é a biblioteca em questão.

luisilva

Viva Carlos! Bem-vindo ao fórum.
Era bastante mais útil se tivesse partilhado o código no qual está a ter o dito erro. Para essa função, não é preciso declarar uma biblioteca, sendo assim, o problema não é falta de biblioteca. Está aqui a referência dessa função pode dar uma vista de olhos, talvez perceba qual é o problema.

Na minha opinião, e pelo erro, falta definir a String à qual está a aplicar a conversão para array.

Em primeiro lugar tem que definir uma String:
Code: [Select]
String oMeuNome="Luis";

depois deve criar um array (para armazenar a conversão):
Code: [Select]
char nome[5];

só depois pode fazer a conversão:
Code: [Select]
oMeuNome.toCharArray(nome, 5);

Pode também estar a fazer mal a chamada da função.

CarlosAdriano

#2
Jul 01, 2015, 10:43 pm Last Edit: Jul 01, 2015, 10:46 pm by CarlosAdriano
 Parece que já consegui resolver esse problema. O problema agora é outro. Aqui vai as mensagens da compilação:
Quote
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::write(unsigned char)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::write(unsigned char const*, unsigned int)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::flush()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::read()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::peek()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::File(SdFile, char const*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::File(SdFile, char const*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::File()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::File()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::name()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::isDirectory()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::read(void*, unsigned int)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::seek(unsigned long)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::position()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::size()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::available()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::close()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\File.cpp.o: In function `File::write(unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:239: multiple definition of `File::operator bool()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\File.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/File.cpp:57: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `callback_pathExists(SdFile&, char*, bool, void*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':

CarlosAdriano

Quote
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `callback_makeDirPath(SdFile&, char*, bool, void*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `callback_rmdir(SdFile&, char*, bool, void*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `callback_remove(SdFile&, char*, bool, void*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `getNextPathComponent(char*, unsigned int*, char*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `walkPath(char*, SdFile&, bool (*)(SdFile&, char*, bool, void*), void*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::begin(unsigned char)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::getParentDir(char const*, int*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::open(char const*, unsigned char)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::exists(char*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::mkdir(char*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::rmdir(char*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SDClass::remove(char*)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `File::openNextFile(unsigned char)'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `File::rewindDirectory()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\SD.cpp.o: In function `callback_pathExists(SdFile&, char*, bool, void*)':
C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:137: multiple definition of `SD'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD.cpp.o:C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp/SD.cpp:234: first defined here
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\utility\Sd2Card.cpp.o: In function `SPIClass::endTransaction()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:275: undefined reference to `SPIClass::interruptMode'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:275: undefined reference to `SPIClass::interruptSave'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\utility\Sd2Card.cpp.o: In function `SPIClass::beginTransaction(SPISettings)':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:179: undefined reference to `SPIClass::interruptMode'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:184: undefined reference to `SPIClass::interruptMode'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:185: undefined reference to `SPIClass::interruptSave'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:186: undefined reference to `SPIClass::interruptMask'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:191: undefined reference to `SPIClass::interruptSave'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\utility\Sd2Card.cpp.o: In function `SPIClass::endTransaction()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:269: undefined reference to `SPIClass::interruptMode'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\utility\Sd2Card.cpp.o: In function `Sd2Card::init(unsigned char, unsigned char)':
C:\Program Files (x86)\Arduino\libraries\SD\src\utility/Sd2Card.cpp:268: undefined reference to `SPIClass::begin()'
C:\Users\Carlos\AppData\Local\Temp\build1725251902118729326.tmp\SD\utility\Sd2Card.cpp.o: In function `SPIClass::endTransaction()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:269: undefined reference to `SPIClass::interruptMode'
collect2.exe: error: ld returned 1 exit status
Erro compilando.

CarlosAdriano

#4
Jul 01, 2015, 10:45 pm Last Edit: Jul 01, 2015, 10:50 pm by CarlosAdriano
Agora o código do programa:
Code: [Select]
#include <SD.h>

#define ENQUANTO 1
#define SE 2
#define IGUAL 3
#define DIFERENTE 4
#define INVERTE 5
#define SETA 6
#define LIMPA 7
#define A_IGUAL 8
#define SUBTRAI 9
#define SOMA 10
#define DIVIDE 11
#define MULTIPLICA 12
#define FECHA_ENQUANTO 13
#define FECHA_CONDICOES 14
#define B_OU 15
#define B_E 16
#define PARENTESES 17
#define FECHA_PARENTESES 18
#define D_IGUAL 19
#define D_DIFERENTE 20
#define D_IGUALUM 21
#define D_IGUALZERO 22
#define D_MAIOR 23
#define D_MENOR 24
#define AVC_IGUAL 25
#define AVC_MAIOR 26
#define AVC_MENOR 27
#define AVV_IGUAL 28
#define AVV_MAIOR 29
#define AVV_MENOR 30



File prog = SD.open("prog.bin");

void setup() {
  Serial.print("Initializing SD card...");
  pinMode(10,OUTPUT);
  SD.begin();
  SD.exists("prog.bin");

}

 
  byte leia(void){
    return prog.read();
  }
  /*
  String leiaS(void){
    String codi = String(prog.read());
    String codf;
    int i=0;
    for(i=1;codi[i]!=NULL;i++)
      strcat(codi[0],codi[i]);
    codf = codi[0];
    return codf;
  }
  */

  String leiaS(void){
    char bt = prog.read();
    char cod[1];
    cod[0] = bt;
    return String(cod);
   
  }
  int leiaI(void){
    return int(prog.read());
  }
 unsigned char leiaC(void){
    unsigned char cod;
    cod = char(prog.read());
    return cod;
  }
 
  void principal(void){
    switch(leia()){
      case ENQUANTO:
        enquanto();
        break;
      case SE:
        break;
 
      case IGUAL:
        digitalWrite(leia(),digitalRead(leia()));
        break;
      case DIFERENTE:
        digitalWrite(leiaI(), inverte(leiaC()));
        break;
      case INVERTE:
        digitalWrite(leia(),inverte(prog.peek()));
        break;
      case SETA:
        digitalWrite(leia(),HIGH);
        break;
      case LIMPA:
        digitalWrite(leia(),LOW);
        break;
 
      case A_IGUAL:
        break;
      case SUBTRAI:
        break;
      case SOMA:
        break;
      case DIVIDE:
        break;
      case MULTIPLICA:
        break;
    }
  }

  unsigned char inverte(unsigned char port){
     if(digitalRead(port)==HIGH)
      return LOW;
     else
      return HIGH;
  }

  void enquanto(void){
    if(decisao()){
      principal();
    }
    else{
      while(leia()!=FECHA_ENQUANTO);
    }
  }

  bool decisao(void){
    bool resultado;
    while(leia()!=FECHA_CONDICOES){
      if(prog.peek()==B_OU)
        resultado = (resultado || condicoes());
      else if(prog.peek()==B_E)
        resultado = (resultado && condicoes());
      else if(prog.peek()==PARENTESES)
        resultado = operadorbool();
      else
        resultado = condicoes();
    }
    return resultado;
  }
  bool operadorbool(void){
    bool result;
    while(leia()!=FECHA_PARENTESES){
      if(prog.peek()==B_OU)
        result = (result || condicoes());
      else if(prog.peek()==B_E)
        result = (result && condicoes());
      else if(prog.peek()==PARENTESES)
        result = operadorbool();
      else
        result = condicoes();
    }
    return result;
  }
 
  bool condicoes(void){
    bool res;
    switch(leia()){
      case D_IGUAL:
        res = (digitalRead(leia())==digitalRead(leia()));
        break;
      case D_DIFERENTE:
        res = (digitalRead(leia())!=digitalRead(leia()));
        break;
      case D_IGUALUM:
        res = (digitalRead(leia())==HIGH);
        break;
      case D_IGUALZERO:
        res = (digitalRead(leia())==LOW);
        break;
      case D_MAIOR:
        res = ((digitalRead(leia())==HIGH)&&(digitalRead(leia())==LOW));
        break;
      case D_MENOR:
        res = ((digitalRead(leia())==LOW)&&(digitalRead(leia())==HIGH));
        break;

      case AVC_IGUAL:
        res = ((analogRead(leia())/255)==(leia()/100));
        break;
      case AVC_MENOR:
        res = ((analogRead(leia())/255)<(leia()/100));
        break;
      case AVC_MAIOR:
        res = ((analogRead(leia())/255)>(leia()/100));
        break;
      case AVV_IGUAL:
        res = (analogRead(leia())==analogRead(leia()));
        break;
      case AVV_MENOR:
        res = (analogRead(leia())<analogRead(leia()));
        break;
      case AVV_MAIOR:
        res = (analogRead(leia())>analogRead(leia()));
        break;
      case PARENTESES:
        res = operadorbool();
        break;
    }
   
    return res;
  }
void loop() {
  prog.available();

  while(prog.available()){
    principal();
  }
 


 
}


Obrigado !

luisilva

No meu caso, eu consigo compilar o sketch sem problemas. Sendo assim, o erro não está no código, mas em alguma configuração.

CarlosAdriano

 Eu já reinstalei, reiniciei, rodei em modo de compatibilidade, tentei com versões anteriores e nada resolve.

CarlosAdriano

Não sei mais o que eu fiz, só sei que começou a dar o erro "SPI.h no such file or directory" ai eu fui no menu skecth>importar bibliotecas>SPI, cliquei no verificar e de repente funcionou !
Obrigado pela disposição.

Go Up