Rewrite code from ATmega328 project to ATMega32U4 board

Hello!
Sorry for the “dummie’s” question :slight_smile:
How to rewrite this code for Arduino Nano board:

#if defined(UBRRH)
#define TX_UCSRA UCSRA
#define TX_UDRE UDRE
#define TX_UDR UDR
#else
#define TX_UCSRA UCSR0A
#define TX_UDRE UDRE0
#define TX_UDR UDR0
#endif

to make it compatible with ATMega32U4 board

Full code attached.
Thank You!

DFMoco_A1_2motors_Micro.ino (35.1 KB)

On the ATmega32U4 the register count starts at 1 and not 0, so UCSR0A is UCSR1A, etc.

Thank You!