Skip to content
New issue

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

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

digitalRead error: cannot bind non-const lvalue reference of type 'byte&' {aka 'unsigned char&'} to an rvalue of type 'byte' {aka 'unsigned char'} #3

Open
mateusz-kusmierz opened this issue Nov 2, 2023 · 0 comments

Comments

@mateusz-kusmierz
Copy link

mateusz-kusmierz commented Nov 2, 2023

Platform: Arduino IDE + ESP32 C3
I'm trying to run your library, I don't have any issues with writing to a pin of PCA9554, but reading does not work:

 if(io.digitalRead(7))    
   {
    io.digitalWrite(1, LOW);
   }
   else 
   {
    io.digitalWrite(1, HIGH);
   }

I'm getting an error:

C:\Users\Dell\AppData\Local\Temp\.arduinoIDE-unsaved2023102-21732-1iynypm.fdd6h\pca9554\pca9554.ino: In function 'void loop()':
C:\Users\Dell\AppData\Local\Temp\.arduinoIDE-unsaved2023102-21732-1iynypm.fdd6h\pca9554\pca9554.ino:46:22: error: cannot bind non-const lvalue reference of type 'byte&' {aka 'unsigned char&'} to an rvalue of type 'byte' {aka 'unsigned char'}
    if(io.digitalRead(7))    io.digitalWrite(1, LOW);
                      ^
In file included from C:\Users\Dell\AppData\Local\Temp\.arduinoIDE-unsaved2023102-21732-1iynypm.fdd6h\pca9554\pca9554.ino:12:
c:\Users\Dell\Documents\Arduino\libraries\PCA9554\src/PCA9554.h:41:8: note:   initializing argument 1 of 'bool PCA9554::digitalRead(byte&)'
   bool digitalRead(byte &pinNumber);
        ^~~~~~~~~~~

Using library PCA9554 at version 0.0.1 in folder: C:\Users\Dell\Documents\Arduino\libraries\PCA9554 
Using library Wire at version 2.0.0 in folder: C:\Users\Dell\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire 
exit status 1

Compilation error: cannot bind non-const lvalue reference of type 'byte&' {aka 'unsigned char&'} to an rvalue of type 'byte' {aka 'unsigned char'}

Thanks for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant