Wire1 error: lvalue required as left operand of assignment

Hi, I tried to use Wire1 from GitHub - watterott/ATmega328PB-Testing: Atmel/Microchip ATmega328PB support for Arduino IDE but when I verify, this error happen:

Wire1.cpp:90:40: error: lvalue required as left operand of assignment
   TWBR1 = ((F_CPU / frequency) - 16) / 2; // error point to number 2
                                                                   

I tried to figure out what happen here. In Wire no problem but when use Wire1 got error, Is it something wrong with this Wire1 ? Thank you.

Your topic was MOVED to its current forum category as it is more suitable than the original

Which Arduino board are you using ?

1 Like

Arduino UNO

An Uno uses an ATmega328P, not a ATmega328PB. So I'm not sure how this is supposed to work, and there is probably more to the error message than wjat you posted.

Your topic has nothing to do with Installation and Troubleshooting and hence has been moved (again); please leave it where it is now.

1 Like

I replaced chip P by PB.

The code is apparently written for a 328PB which has a "TWBR1" register but, the compiler is being told your "UNO" has a 328P. The equivalent register on a 328P is named "TWBR". You need an Arduino core that supports the 328PB. Perhaps this one:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.