How to use all available pins on Leonardo (atmega32U4)

I hope this helps someone wanting to use HWB pin in a sketch...

DDRE |= (1<<2);

#define _HWB_H() (PORTE |= (1<<2))
#define _HWB_L() (PORTE &= ~(1<<2))

To pull HWB high, simply

_HWB_H(); // or _HWB_L(); to pull it low

1 Like