Rotary encoder arduino Mega 2560

Hi there,

I am using arduino Uno with an rotary encoder and LCD for a cocktail machine. I don't have enought pins on my arduino uno so I ordered a arduino MEGA. When I changed the boards, i recognised that the rotary encoder doesn't work. The rotary button does work but not the rotations. On my arduino mega the clk and data where on pin 8 and 9.
I'm not an arduino pro so the code probally isn't perfect

Code_distributeur_de_boisson_2.ino (14.7 KB)

Please post your code according to the forum guide in the sticky post, and also post a schematic. Most forum members use phones & tablets most of the time and can't open .ino files.

PB0 on the Mega2560 board is brought out to pin 53 and PB1 is on pin 52. Move your clk and data to these pins and try it again.

Thanks, pin 53 and 52 worked !