How-to: more responsive keyboard...

Hi, I have the web4robot.com serial adapter for LCD and keyboard. I hooked-up the LCD and keyboard to it, and I can get pretty good results. The only issue I see is that sometimes, I have to hit 2 or 3 times a key in order to get an answer. On my i2c bus, I have: - lcd - keyboard - rtc - eeprom

on digital/analog inputs, I have: - IR sensor - hall-effect sensor - shift-out register + IC buffer +leds - 1-wire temp sensors (2) - more to come

So, as you can see, the loop() function has to spend some time getting all these values.

Do you think, that speeding up the i2c bus to 400Mz can solve this issue? Do you have any advises or things to check to make this keyboard more responsive. ::)

Thanks!

you can make a counter inside your loop to spread out the less important things

fake code.

loop{

count 0-3 if count > 3 then count = 0

switch (counter){ case 0: do less important slow thing like updating the LCD; break; case 1: do less important or slow thing like analogread ; break; case 2: do less important thing; break; case 3: do less important thing; break; }

poll keyboard and do other time sensitive things

}

that way less time is spent per loop and there is more chance you will get your keypresses.

good idea, I will try. Thanks!

Do you think, that speeding up the i2c bus to 400Mz can solve this issue?

I assume that was a typo for 400kHz :slight_smile:

That might help, if you’re doing a lot of I2C I/O that’s keeping the Arduino busy.

But it also might hurt: when I was working on the LCDi2c library, I ran into problems that appeared to be the web4robot board not keeping up with incoming screen writes. It seemed to work fine on serial at 9600 baud, though.

So you might cause problems with the LCD by increasing the data rate.

hi,

yes, you got it, a typo ... I will try to tune my loop() function ... thanks, I will keep you in touch !