Go Down

Topic: exit status 1 (Read 178559 times) previous topic - next topic

Danny_John

i have the same problem and I don't know the issue,
 pls help me il provide the code and the error

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\DJ\AppData\Local\Temp\ccAvpEt3.ltrans0.ltrans.o:(.rodata+0x6): undefined reference to `Print::write(unsigned char const*, unsigned int)'

c:/users/dj/desktop/some stuff/school/mech/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

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

pert

pls help me
Try closing all Arduino IDE windows and then start the Arduino IDE and try again. I think that usually fixed your particular problem.

brianwilson

I'm having the same Error Status 1 problem and can't seem to get to the bottom of it. Have reinstalled 1.8.5 IDE twice now. No difference.

Trying to compile basic humidity and temp sensor sketch. It used to work. I've moved on to trying another when I discovered it would not compile, then moved back and can't even compile this sketch now.

Seems the error status 1 is a fairly basic error - usually about missing folders etc. Have fixed that in past. This however within 'temp' folder is created by IDE (I'm guessing) while trying to compile.

Any pointers/suggestions etc would be welcomed. I'm at my limit of knowledge.

Thanks in advance

Brian
Windows XP SP3, Arduino 1.8.5 java version 1.8 on computer

==================================================
Here is the verbose output - I've removed some of the section that seems to work fine. Problem seems to appear only once it stars generating prototypes.

Arduino: 1.8.5 (Windows XP), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM, Only Sketch, 115200"



Generating function prototypes...
"C:\Documents and Settings\brian\Local Settings\Application Data\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Documents and Settings\brian\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1/tools/sdk/include" "-IC:\Documents and Settings\brian\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1/tools/sdk/lwip2/include" "-IC:\Documents and Settings\brian\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\DOCUME~1\brian\LOCALS~1\Temp\arduino_build_366817/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536  -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h" -DARDUINO=10805 -DARDUINO_ESP8266_ESP12 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP12"   -DESP8266 "-IC:\Documents and Settings\brian\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266" "-IC:\Documents and Settings\brian\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\variants\adafruit" "C:\DOCUME~1\brian\LOCALS~1\Temp\arduino_build_366817\sketch\sensor-test.ino.cpp" -o "C:\DOCUME~1\brian\LOCALS~1\Temp\arduino_build_366817\preproc\ctags_target_for_gcc_minus_e.cpp"
exit status 1
Error compiling for board Adafruit Feather HUZZAH ESP8266.

Isha_pandey

i even get this message in an empty sketch

pert

i even get this message in an empty sketch
That's expected. Every sketch must contain a setup() and loop() function, even if those functions are left empty. For this reason, if you try to compile an empty sketch it will certainly have an error. Here is the bare minimum sketch:
Code: [Select]
void setup() {
}
void loop() {
}

BurningIce53

#80
Dec 09, 2018, 07:22 pm Last Edit: Dec 09, 2018, 07:31 pm by BurningIce53
Hello there

I'm new to Arduino and I'm building a remote controlled robot. I saw someone here working on the same thing but unfortunately they had a different error.

Code: [Select]
C:\Users\gugge\AppData\Local\Temp\ccW56HtB.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:5: undefined reference to `IRrecv::IRrecv(int)'

C:\Users\gugge\AppData\Local\Temp\ccW56HtB.ltrans0.ltrans.o: In function `setup':

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:11: undefined reference to `IRrecv::enableIRIn()'

C:\Users\gugge\AppData\Local\Temp\ccW56HtB.ltrans0.ltrans.o: In function `loop':

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:16: undefined reference to `IRrecv::decode(decode_results*)'

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:19: undefined reference to `IRrecv::resume()'

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "IRremote.h"
 Used: C:\Users\gugge\Documents\Arduino\libraries\IRremote
 Not used: C:\Users\gugge\Documents\Arduino\libraries\arduino_362116
Using library IRremote in folder: C:\Users\gugge\Documents\Arduino\libraries\IRremote (legacy)
exit status 1
Error compiling for board Arduino/Genuino Uno.


These are the error codes I'm getting and while I've already fixed some errors before this I don't know what they mean by undefined reference. Everything else is in white so I'm assuming those are fine and what's in red is the error.

Oh and here's the code that I'm using
Code: [Select]
#include <IRremote.h>
#include <IRremoteInt.h>

int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  irrecv.enableIRIn(); //start reciever
}

void loop() {
  // put your main code here, to run repeatedly:
  if (irrecv.decode(&results))
  {
    Serial.println(results.value, HEX);
    irrecv.resume(); //recieve next val
    delay(500);
  }
}


If anyone could help me out that would be great

EDIT: I forgot to mention, I understand that the program doesn't think that there's a receiver but the thing is there is one in the program so that's what's tripping me up. What's exactly stoppin the computer from reading that i added in the sensor to the code?

slipstick

What it's telling you is that you have several different IRremote libraries on your computer and that has confused the compiler.

You need to find these libraries and remove all of them except the one you should be using. In fact it's probably best to remove them all and reinstall the latest correct version.

Steve

BurningIce53

#82
Dec 09, 2018, 10:09 pm Last Edit: Dec 09, 2018, 10:10 pm by BurningIce53
Sorry im on mobile cuz im heading to work rn but ive already tried deleting everything not related to it in the library. I dont know what else its picking up.

Ill try again when i get home tho, maybe i over looked one

techenoid123

I am referring a link I think this link will help you to

https://github.com/arduino/Arduino/issues/7471
techenoid learning

pert

I dont know what else its picking up.

Ill try again when i get home tho, maybe i over looked one
When there are multiple libraries that contain a file matching your #include directive, the Arduino IDE provides some helpful information that tells you which one it decided to use:
Code: [Select]
Multiple libraries were found for "IRremote.h"
 Used: C:\Users\gugge\Documents\Arduino\libraries\IRremote
 Not used: C:\Users\gugge\Documents\Arduino\libraries\arduino_362116
Using library IRremote in folder: C:\Users\gugge\Documents\Arduino\libraries\IRremote (legacy)

This tells you there is a file named "IRremote.h" in both C:\Users\gugge\Documents\Arduino\libraries\IRremote and C:\Users\gugge\Documents\Arduino\libraries\arduino_362116. It may be that your sketch code was written for the library in C:\Users\gugge\Documents\Arduino\libraries\arduino_362116 and is not compatible with the library in C:\Users\gugge\Documents\Arduino\libraries\IRremote that's being used. Without being able to look at the libraries, I couldn't say for sure.

You might be wondering about this strange folder name: C:\Users\gugge\Documents\Arduino\libraries\arduino_362116. When you install a library via the Arduino IDE's Library Manager (Sketch > Include Library > Manage libraries), and a library of the same name is already installed, the Arduino IDE tries to be careful to avoid a situation where it overwrites a custom library that you might not be able to recover. The way it does that is by installing the new library to a random folder name like arduino_362116. When multiple libraries have the same file name, one of the factors in which gets priority is whether the folder name matches the file name. So for the file name IRremote.h, C:\Users\gugge\Documents\Arduino\libraries\IRremote is chosen.

BurningIce53

#85
Dec 10, 2018, 06:41 pm Last Edit: Dec 10, 2018, 07:02 pm by BurningIce53
What it's telling you is that you have several different IRremote libraries on your computer and that has confused the compiler.

You need to find these libraries and remove all of them except the one you should be using. In fact it's probably best to remove them all and reinstall the latest correct version.

Steve
Hey Steve, I'm using a school laptop currently and can't wipe the library because other projects are using it but I did try taking the two header files within the library and putting them in their own file but that didn't fix the issue either.
I am referring a link I think this link will help you to

https://github.com/arduino/Arduino/issues/7471
I have tried restarting Arduino but I haven't tried turning on the laptop on and off again yet, thanks.
When there are multiple libraries that contain a file matching your #include directive, the Arduino IDE provides some helpful information that tells you which one it decided to use:
Code: [Select]
Multiple libraries were found for "IRremote.h"
 Used: C:\Users\gugge\Documents\Arduino\libraries\IRremote
 Not used: C:\Users\gugge\Documents\Arduino\libraries\arduino_362116
Using library IRremote in folder: C:\Users\gugge\Documents\Arduino\libraries\IRremote (legacy)

This tells you there is a file named "IRremote.h" in both C:\Users\gugge\Documents\Arduino\libraries\IRremote and C:\Users\gugge\Documents\Arduino\libraries\arduino_362116. It may be that your sketch code was written for the library in C:\Users\gugge\Documents\Arduino\libraries\arduino_362116 and is not compatible with the library in C:\Users\gugge\Documents\Arduino\libraries\IRremote that's being used. Without being able to look at the libraries, I couldn't say for sure.

You might be wondering about this strange folder name: C:\Users\gugge\Documents\Arduino\libraries\arduino_362116. When you install a library via the Arduino IDE's Library Manager (Sketch > Include Library > Manage libraries), and a library of the same name is already installed, the Arduino IDE tries to be careful to avoid a situation where it overwrites a custom library that you might not be able to recover. The way it does that is by installing the new library to a random folder name like arduino_362116. When multiple libraries have the same file name, one of the factors in which gets priority is whether the folder name matches the file name. So for the file name IRremote.h, C:\Users\gugge\Documents\Arduino\libraries\IRremote is chosen.
Oh I have two IRremote folders as per the instructions in the video, one has rest of the code and the other folder has the headers. Should I try renaming one?

EDIT: I've tried renaming the folder with the rest of the code and that didn't really work but it did something at least. I'm getting new errors now at least.

Code: [Select]

Arduino: 1.6.7 (Mac OS X), Board: "Arduino/Genuino Uno"

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware "/Applications/Arduino.app/Contents/Java/hardware" -tools "/Applications/Arduino.app/Contents/Java/tools-builder" -tools "/Applications/Arduino.app/Contents/Java/hardware/tools/avr" -built-in-libraries "/Applications/Arduino.app/Contents/Java/libraries" -libraries "/Users/MakerAdmin01/Documents/Arduino/libraries" -fqbn=arduino:avr:uno -ide-version=10607 -build-path "/var/folders/hq/q1n5dht113dg5lpp4vydbr3w0000gn/T/build0adaacc3f9588a99f16f52d4278761c6.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "/Users/MakerAdmin01/Documents/Arduino/rmt.cpp/rmt.cpp.ino"
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware "/Applications/Arduino.app/Contents/Java/hardware" -tools "/Applications/Arduino.app/Contents/Java/tools-builder" -tools "/Applications/Arduino.app/Contents/Java/hardware/tools/avr" -built-in-libraries "/Applications/Arduino.app/Contents/Java/libraries" -libraries "/Users/MakerAdmin01/Documents/Arduino/libraries" -fqbn=arduino:avr:uno -ide-version=10607 -build-path "/var/folders/hq/q1n5dht113dg5lpp4vydbr3w0000gn/T/build0adaacc3f9588a99f16f52d4278761c6.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "/Users/MakerAdmin01/Documents/Arduino/rmt.cpp/rmt.cpp.ino"
failed MSpanList_Insert 0x308fd8 0xd210435e51 0x0
fatal error: MSpanList_Insert

runtime stack:
runtime.MSpanList_Insert(0x2c3c90, 0x308fd8)
/usr/local/go/src/runtime/mheap.c:692 +0x8f
runtime.MHeap_Free(0x2c3c20, 0x308fd8, 0xc200000000)
/usr/local/go/src/runtime/mheap.c:500 +0x5b
runtime.MCentral_FreeSpan(0x2cb2d8, 0x308fd8, 0x5, 0xc208098000, 0xc2080982c0, 0x1000, 0x64)
/usr/local/go/src/runtime/mcentral.c:181 +0x1bb
runtime.MSpan_Sweep(0x308fd8, 0x1f00000000, 0x1)
/usr/local/go/src/runtime/mgc0.c:1099 +0x477
runtime.MHeap_Alloc(0x2c3c20, 0x2, 0x10000000022, 0x10219)
/usr/local/go/src/runtime/mheap.c:240 +0x66
runtime.MCentral_CacheSpan(0x2ccb98, 0x2cf1b8)
/usr/local/go/src/runtime/mcentral.c:85 +0x167
runtime.MCache_Refill(0x304000, 0xc200000022, 0x309c08)
/usr/local/go/src/runtime/mcache.c:90 +0xa0

goroutine 1 [running]:
runtime.switchtoM()
/usr/local/go/src/runtime/asm_amd64.s:198 fp=0xc20806f290 sp=0xc20806f288
runtime.mallocgc(0x580, 0x19f7e0, 0xc200000000, 0xc2080c3360)
/usr/local/go/src/runtime/malloc.go:178 +0x849 fp=0xc20806f340 sp=0xc20806f290
runtime.newarray(0x19f7e0, 0x4, 0xd)
/usr/local/go/src/runtime/malloc.go:365 +0xc1 fp=0xc20806f378 sp=0xc20806f340
runtime.hashGrow(0x1576e0, 0xc20803c660)
/usr/local/go/src/runtime/hashmap.go:744 +0x86 fp=0xc20806f3a8 sp=0xc20806f378
runtime.mapassign1(0x1576e0, 0xc20803c660, 0xc20806f5e0, 0xc20806f6e8)
/usr/local/go/src/runtime/hashmap.go:456 +0x568 fp=0xc20806f448 sp=0xc20806f3a8
arduino.cc/builder.(*LibrariesLoader).Run(0x2bd908, 0xc20803c510, 0x0, 0x0)
/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/libraries_loader.go:106 +0x12db fp=0xc20806f788 sp=0xc20806f448
arduino.cc/builder.(*ContainerSetupHardwareToolsLibsSketchAndProps).Run(0x2bd908, 0xc20803c510, 0x0, 0x0)
/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/container_setup.go:59 +0x6b8 fp=0xc20806f978 sp=0xc20806f788
arduino.cc/builder.runCommands(0xc20803c510, 0xc20806fb90, 0x1d, 0x1d, 0x19401, 0x0, 0x0)
/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:187 +0x139 fp=0xc20806fa08 sp=0xc20806f978
arduino.cc/builder.(*Builder).Run(0xc20806fd88, 0xc20803c510, 0x0, 0x0)
/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:118 +0xef7 fp=0xc20806fd68 sp=0xc20806fa08
arduino.cc/builder.RunBuilder(0xc20803c510, 0x0, 0x0)
/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:218 +0x49 fp=0xc20806fd90 sp=0xc20806fd68
main.main()
/Users/jenkins/jenkins/workspace/arduino-builder-macosx/main.go:311 +0x1eb2 fp=0xc20806ff98 sp=0xc20806fd90
runtime.main()
/usr/local/go/src/runtime/proc.go:63 +0xf3 fp=0xc20806ffe0 sp=0xc20806ff98
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc20806ffe8 sp=0xc20806ffe0
arduino-builder returned 2
Error compiling.

pert

Hey Steve, I'm using a school laptop currently and can't wipe the library because other projects are using it but I did try taking the two header files within the library and putting them in their own file but that didn't fix the issue either. Oh I have two IRremote folders as per the instructions in the video, one has rest of the code and the other folder has the headers. Should I try renaming one?
It's not clear to me exactly what is going on. Please provide some more information.

I haven't tried turning on the laptop on and off again yet, thanks.
I don't think that link has any relevance to your problem. There are a near infinite number of causes of an "exit status 1". That just means that something went wrong. So you shouldn't assume that every "exit status 1" problem has the same solution. You need to look at the specific error messages in the output instead of the super generic "exit status 1" error.

EDIT: I've tried renaming the folder with the rest of the code and that didn't really work but it did something at least. I'm getting new errors now at least.
I believe this error is caused by you using a very outdated version of the Arduino IDE which is not compatible with your macOS version. Please update to Arduino IDE 1.8.8.
Reference: https://github.com/arduino/Arduino/issues/5360

BurningIce53

#87
Dec 17, 2018, 12:11 am Last Edit: Dec 17, 2018, 12:22 am by BurningIce53
It's not clear to me exactly what is going on. Please provide some more information.
Sorry it took me a while to respond, but what kind of information do you need?
Quote
I don't think that link has any relevance to your problem. There are a near infinite number of causes of an "exit status 1". That just means that something went wrong. So you shouldn't assume that every "exit status 1" problem has the same solution. You need to look at the specific error messages in the output instead of the super generic "exit status 1" error.
I'm looking at my status errors, and they're now just undefined references. I'm not too sure why it's saying it's not defined because I'm looking at the code and I did define it before using it. I don't think I'm explaining it too well so I'm going to respost the code here:
Code: [Select]

#include <IRremote.h>
#include <IRremoteInt.h>

int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  irrecv.enableIRIn(); //start reciever
}

void loop() {
  // put your main code here, to run repeatedly:
  if(irrecv.decode(&results))
  {
    Serial.println(results.value, HEX);
    irrecv.resume(); //recieve next val
         delay(500);
  }
}

And the error messages here
Code: [Select]

C:\Users\gugge\AppData\Local\Temp\ccnGifPl.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:5: undefined reference to `IRrecv::IRrecv(int)'

C:\Users\gugge\AppData\Local\Temp\ccnGifPl.ltrans0.ltrans.o: In function `setup':

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:11: undefined reference to `IRrecv::enableIRIn()'

C:\Users\gugge\AppData\Local\Temp\ccnGifPl.ltrans0.ltrans.o: In function `loop':

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:16: undefined reference to `IRrecv::decode(decode_results*)'

C:\Users\gugge\Downloads\h&b\IRremote\rmt.cpp/rmt.cpp.ino:19: undefined reference to `IRrecv::resume()'

collect2.exe: error: ld returned 1 exit status

I don't know if that helps, but I think it should help clear up that there shouldn't be anything that's undefined.
Quote
I believe this error is caused by you using a very outdated version of the Arduino IDE which is not compatible with your macOS version. Please update to Arduino IDE 1.8.8.
Reference: https://github.com/arduino/Arduino/issues/5360
Thanks, on my actual laptop I'm running 1.8.7 but I figure I'll update it anyways just to see if it makes a difference.
EDIT: WOO HOO! IT DID! It compiles now that I updated the IDE! Now to see if it'll have my robot running properly now. Thanks a bunch pert!

Can123r45356

Hello, I'm doing a school project, but arduino have a error of compilation


************************************************************************
                    ESTACIÓN METEOROLÓGICA
     ESTE PROYECTO HA SIDO REALIZADO PARA EL PROYECTO GLOBE - CLIMA
                FEBRERO - MARZO y ABRIL DE 2016
            Modificado por Wilmer Luis Marrero para el GIE
                        Céfiro Educa 2017
*/
/*Sensor de Temperatura y Humedad DHTxx y BMP180 en Display LCD
 * Instrucciones:
Recuerda descargar las librerias DHT y BMP para poder utilizar este sensor
así como la librería de la LCD
Conectaremos el Sensor DHTxx a 5v y el pin de señal a la entrada digital 6
que corresponde al pin 8 de la shield de protoboard
*OJO* Utilizaremos un Display LCD controlado mediante un Modulo Serial I2C
*/

////////Incluimos las librerias necesarias//////////
#include <SFE_BMP180.h> // Incluímos las librerías del sensor de presión / altura
#include <Wire.h>                 
#include <LiquidCrystal_I2C.h> //Incluimos la libreria de la LCD   
LiquidCrystal_I2C lcd(0x27, 16, 2);//Direccion de LCD
//Si la pantalla se ve con cuadrados en blanco, es porque la I2C Adress no es la correcta
//y tendremos que cambiar 0x3F por 0x27 por ejemplo
#include "DHT.h" //Incorporamos la librería DHT encargada de leer humedad y temperatura

/////////Definimos las variables/////////
#define DHTPIN D6 //Definimos el pin donde se conecta el data del sensor DHT
#define DHTTYPE DHT22      // Si el sensor que estamos usando es el DHT 22
//#define DHTTYPE DHT11   // Si el sensor que estamos usando es el DHT 11
DHT dht(DHTPIN, DHTTYPE);
SFE_BMP180 pressure;

//Se declaran las variables. Es necesario tomar en cuenta una presión inicial
//esta será la presión que se tome en cuenta en el cálculo de la diferencia de altura
double PresionBase;
//Leeremos presión y temperatura. Calcularemos la diferencia de altura
double Presion = 0;
double Altura = 0;
double Temperatura = 0;
char status;

void setup() {
  Serial.begin(9600);
  lcd.init();// INICIAMOS LCD
  lcd.backlight(); // HABILITA EL BACKLIGHT (LUZ DE FONDO)
  lcd.print("Leyendo sensores");
  dht.begin();
  //Se inicia el sensor y se hace una lectura inicial
  SensorStart();
}

void loop() {
int err;
       float temp=dht.readTemperature();
       float hum=dht.readHumidity();
       
       if (isnan(hum)||isnan(temp)){
         Serial.print("error de lectura");
         return; }
          lcd.clear();
             lcd.setCursor(0,0);
             lcd.print("Temp.: ");
             lcd.print(temp);
             lcd.print(" ");
             lcd.print((char)223);
             lcd.print("C");
             lcd.setCursor(0,1);
             lcd.print("Hdad: ");
             lcd.print(hum);
             lcd.print(" %");
       
       delay(3000);            //Recordad que solo lee una vez por segundo

ReadSensor();
lcd.clear();//Elimina todos los simbolos del LCD
lcd.setCursor(0,0);//Posiciona la primera letra en fila 0 columna 0     
//Se imprimen las variables
lcd.print("Hrel.: ");
lcd.print(Altura);
lcd.print(" m");
lcd.setCursor(0,1);
lcd.print("P: ");
lcd.print(Presion);
lcd.print(" mbar");
 
delay(3000);
//Cada 3 segundos hará una nueva lectura
}

void SensorStart() {
//Secuencia de inicio del sensor
if (pressure.begin())
Serial.println("BMP180 iniciado adecuadamente");
else
{
Serial.println("La inicialización del sensor BMP180 falló");
while (1);
}
//Se inicia la lectura de temperatura
status = pressure.startTemperature();
if (status != 0)  {
delay(status);
//Se lee una temperatura inicial
status = pressure.getTemperature(Temperatura);
if (status != 0)    {
//Se inicia la lectura de presiones
status = pressure.startPressure(3);
if (status != 0)     
{
delay(status);
//Se lee la presión inicial incidente sobre el sensor en la primera ejecución
status = pressure.getPressure(PresionBase, Temperatura);
}
}
}
}

void ReadSensor() {
//En este método se hacen las lecturas de presión y temperatura y se calcula la altura
//Se inicia la lectura de temperatura
status = pressure.startTemperature();
if (status != 0)
{
delay(status);
//Se realiza la lectura de temperatura
status = pressure.getTemperature(Temperatura);
if (status != 0)
{
//Se inicia la lectura de presión
status = pressure.startPressure(3);
if (status != 0)
{
delay(status); //Pausa para que finalice la lectura

//Se lleva a cabo la lectura de presión,
//considerando la temperatura que afecta el desempeño del sensor
status = pressure.getPressure(Presion, Temperatura);
if (status != 0)
{

//Cálculo de la altura en base a la presión leída en el Setup
Altura = pressure.altitude(Presion, PresionBase);
}
else Serial.println("Error en la lectura de presion\n");
}
else Serial.println("Error iniciando la lectura de presion\n");
}
else Serial.println("Error en la lectura de temperatura\n");
}
else Serial.println("Error iniciando la lectura de temperatura\n");


///////////////////////////////////////////////////             
lcd.clear();
lcd.setCursor(2,0); //escribe en la primera linea después del caracter 2
lcd.print("Cefiro Educa");                     
  delay (2500);
}

pert

Hello, I'm doing a school project, but arduino have a error of compilation
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages" (or the icon that looks like two pieces of paper in the Arduino Web Editor). Click that button. Paste the error in a message here USING CODE TAGS (</> button on the forum toolbar). If the text exceeds the forum's 9000 character limit, save it to a text file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.

Go Up