LCD_I2C and rotary encoder

Hey,

Well, i've achieved to get good readings with an rotary encoder on the serial monitor. Just a counter. But, the moment that I connect the LCD_I2C, a lot of errors occurs. So i've put the LCD on a separate power supply and connected the grounds in common. Still the same problem.

But the monent that I disconnect the power of the LCD everthing works fine again.
Is it possible that the I2C library bugs with the settings of the rotary encoder?

Is this a known problem?

Thankx

lcdtestrotary.ino (3.84 KB)

Hi
I think you have to take away the print instructions from the interrupt routine, because they are slow then interrupt loses some pulses from the encoder.

Why would you use interrupts to read a rotary encoder?

I have done it without interrupts: it works, but sometimes some click is lose... It depends on the lenght of the whole loop.

I used an interrupt because i am creating a menu. Allready have it working with buttons but now i will try with a rotary switch. I based myself on an example on internet. Still, i am playing with capacitators now to get better readings.
I go step by step :slight_smile: .

Here I have put the code for the menu. As you can see the menu works with counters. So I can't permit to lose a click. The menu comes from internet and is the only one which works for me. Couldn't get the other examples to work. But hey, The menu allready works with the buttons so I don't really have a problem. But I would really like to have the rotary working. I do think that if I find the right combination of capacitators the problem is solved. I seems that a capacitator 104 works fine with only a serial monititor. When I connect the LCD I2C the readings with the same caps are worthless. But now i've changend them to 471 and it allready works better. But not yet as it should. I'll keep trying.

StartMenu.ino (13 KB)