Add push buttons on LV-168

Hi,

I’m trying to add some buttons on my LV-168, and I would like to do it in the OrangutanPushbuttons_h library.

#define TOP_BUTTON		(1 << 5)	// PB1; Arduino pin 13
#define MIDDLE_BUTTON	(1 << 4)	// PB4; Arduino pin 12
#define BOTTOM_BUTTON	(1 << 1)	// PB5; Arduino pin 9

I tried to add #define NEW_BUTTON (1 << PD0) to add a button on the PDO I/O but it doesn’t work.
What do you think about this?

Thanks

Hello,

PD0 is just defined to be the number 0 - there is nothing about that definition that will automatically cause the rest of the code to look for a button of port D instead of B. Take a look at other parts of the code which use PORTB and DDRB, since you will have to modify them to work with your new button.

Alternatively, you could do it without modifying the library, by copying some functions from the library into your code and modifying them to work with PORTD.

-Paul

Okey thanks Paul.
I will try.