Go Down

Topic: Compiling Problem on UNO WiFi Rev2 (Read 705 times) previous topic - next topic

Parab0lix

Hey everybody,

i'm kinda new but somehow managed to get along so far. Now i'm standing before my first actual problem, that i can't fix by myself.

This is my source code:

Quote
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Der Sensor erhält den Namen "dht"
DHT dht(2, DHT11);
 
// Setze die LCD Addresse auf 0x27 für ein 16 Zeichen und 2 Zeilen-Display
// Manche (so wie meins) verwenden auch die Adresse 0x3F
// Setze die pins auf dem I2C-Chip, die für die LCD-Verbindungen verwendet werden:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);


void setup() {
  // Initialisieren des LCD-Displays für 16 Zeichen und 2 Zeilen
  lcd.begin(16,2);
  // Hintergrundbeleuchtung einschalten 
  lcd.backlight(); 

  // Sensor initialisieren
  dht.begin();
}


void loop() {

  // 2 Sekunden warten
  delay(2000);

  // Position setzen, Temperatur messen und anzeigen
  lcd.setCursor(0,0);
  lcd.print("Temp.: ");
  lcd.print(dht.readTemperature());

  // Position setzen, Luftfeuchtigkeit messen und anzeigen
  lcd.setCursor(0,1);
  lcd.print("Humidity: ");
  lcd.print(dht.readHumidity());
}
And this is the error i'm getting right now:


Quote
Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino Uno WiFi Rev2, ATMEGA328"

Build-Optionen wurden verändert, alles wird neu kompiliert
C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\I2CIO.cpp: In member function 'uint8_t I2CIO::read()':

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\I2CIO.cpp:147:47: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:

       Wire.requestFrom ( _i2cAddr, (uint8_t)1 );

                                               ^

In file included from C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\I2CIO.cpp:54:0:

C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\libraries\Wire\src/Wire.h:62:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)

     uint8_t requestFrom(int, int);

             ^

C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\libraries\Wire\src/Wire.h:60:13: note: candidate 2: virtual uint8_t TwoWire::requestFrom(uint8_t, size_t)

     uint8_t requestFrom(uint8_t, size_t);

             ^

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\FastIO.cpp: In function 'volatile uint8_t* fio_pinToOutputRegister(uint8_t, uint8_t)':

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\FastIO.cpp:52:38: warning: invalid conversion from 'uint8_t {aka unsigned char}' to 'PinStatus' [-fpermissive]

       digitalWrite(pin, initial_state); // also turns off pwm timer

                                      ^

In file included from C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\cores\arduino/api/ArduinoAPI.h:52:0,

                 from C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\cores\arduino/Arduino.h:23,

                 from C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\FastIO.h:46,

                 from C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\FastIO.cpp:43:

C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\cores\arduino/api/Common.h:104:6: note:   initializing argument 2 of 'void digitalWrite(pin_size_t, PinStatus)'

 void digitalWrite(pin_size_t pinNumber, PinStatus status);

      ^

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp: In member function 'virtual void LiquidCrystal::send(uint8_t, uint8_t)':

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp:137:48: error: cannot convert 'bool' to 'PinStatus' for argument '2' to 'void digitalWrite(pin_size_t, PinStatus)'

    digitalWrite( _rs_pin, ( mode == LCD_DATA ) );

                                                ^

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp: In member function 'void LiquidCrystal::writeNbits(uint8_t, uint8_t)':

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp:329:48: warning: invalid conversion from 'int' to 'PinStatus' [-fpermissive]

       digitalWrite(_data_pins, (value >> i) & 0x01);

                                                ^

In file included from C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\cores\arduino/api/ArduinoAPI.h:52:0,

                 from C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\cores\arduino/Arduino.h:23,

                 from C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp:48:

C:\Users\janni\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.6.26\cores\arduino/api/Common.h:104:6: note:   initializing argument 2 of 'void digitalWrite(pin_size_t, PinStatus)'

 void digitalWrite(pin_size_t pinNumber, PinStatus status);

      ^

exit status 1
Fehler beim Kompilieren für das Board Arduino Uno WiFi Rev2.

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.
What can i do now? What kind of  problem is this anyway?

pert

The error:
Code: [Select]

C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp:137:48: error: cannot convert 'bool' to 'PinStatus' for argument '2' to 'void digitalWrite(pin_size_t, PinStatus)'

    digitalWrite( _rs_pin, ( mode == LCD_DATA ) );

is because the NewLiquidCrystal_lib's code uses boolean values as the second argument to digitalWrite. The type of that parameter was changed from uint8_t to PinStatus, thus the error. The solution is to use HIGH and LOW. The types of those variables were changed at the same time. Although this could be seen as a breaking change in the Arduino core library API, it's also not best practices for the NewLiquidCrystal_lib to assume that HIGH is equivalent to true and LOW is equivalent to false. Although that happened to work, it was in no way guaranteed to continue to work.

You can fix the library like this:
Open C:\Users\janni\Documents\Arduino\libraries\NewLiquidCrystal_lib\LiquidCrystal.cpp in a text editor.

Change line 137 from:
Code: [Select]
digitalWrite( _rs_pin, ( mode == LCD_DATA ) )
to:
Code: [Select]
digitalWrite( _rs_pin, ( mode == LCD_DATA ? HIGH : LOW ) );

Save the file.


If you're not familiar with the syntax of the new code, you can research the conditional, or ternary, operator:
https://en.cppreference.com/w/cpp/language/operator_other

This type of breakage caused by the new core has been reported here:
https://github.com/arduino/ArduinoCore-API/issues/25

Parab0lix

#2
Jun 15, 2019, 10:57 am Last Edit: Jun 15, 2019, 12:20 pm by Parab0lix
Okay now i've changed sth. Like you told me i used the boolean HIGH LOW.
Also i worked on my settings  :smiley-sweat: I changed the programmer from an external back to the onboard, also i've turned off the emulator (i was using ESP before).

Now there still is an error:


Quote
avrdude: WARNING: invalid value for unused bits in fuse "fuse5", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xcd instead of 0xc9 (double check with your datasheet first).
don't know what this is either :/

pert

That's a warning, not an error. It's normal and expected and doesn't indicate any problem. Just ignore it.

Parab0lix

I'm sry but this isn't quite helpful... it's not working properly (nothing happens) :/
How can i find out if i didn't just wrecked my Arduino?


pert

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded the NewLiquidCrystal library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

Go Up