Sparkfun serial 20x4 LCD display causing unresponsive buttons.

Hi,
I’ve built a control panel with 12 buttons, 14 mosfet outputs, an LCD display and a temp and flow inputs and so on…

I’ve programmed it with the code below and all works, sort of, but the buttons are a right pain in the bottom.
They are programmed to toggle on an off and I’ve used various programming techniques so far and I’m still having the same unresponsiveness, so i started playing around with other aspects of the code and found that when I don’t send anything to the display the buttons work a treat!

Is the process of sending the information to the screen via serial that slow that its halting the loop??
I’ve tried getting some sort of loop frequency on the serial monitor but failed.

Some help and guidance would be much appreciated thanks.

Makerplot_lemonade_test_w_flowreadadjust.ino (11.4 KB)

Your code appears to be printing to the serial port and to the LCD every cycle?

Suggestion is to only write to both / either if some part of your data has changed.

This is not real code but I'll try to convey...

    int OLD_flow_rate1 = 0; // not sure on int 
    // etc.
    int OLD_NbTopsFan1 = 0; // not sure on int
    int OLD_NbTopsFan2 = 0; // not sure in int
    // etc.
    int OLD_temp_5 = 0;


void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly: 

// Your code goes here and is not shown

    flow_rate1 = ((NbTopsFan1 / 5.5)*((now-window_start)/1000)/60)*0.8; //(Pulse frequency x 60) / 5.5Q, = flow rate in L/hour 
if (flow_rate1 != OLD_flow_rate1) { // if some data changed then print otherwise check data again

  SerialPrint_Sensor();
    LCDPrint_Sensor(menu_case);
}
}

Is your serial display scrolling non stop and is your LCD is flickering?

Thanks very much for your reply Carl!

I've had to remove any screen clears because the 20x4, unlike the 16x2, takes a while to print all the characters onto the display!

So no, it doesn't flicker but the serial monitor scrolls none-stop.

I'm using the data sent over the usb serial to a plotting programme on the pc.

I've done alot of testing and found that the serial data doesn't harm the operation of the buttons whatsoever, its just the serial display!!

I've tried the code you've suggested and it works a treat whilst none of the sensor data is changing but don't have the rest of the kit to try at the moment!

I've tried using "Serial3" instead of the software serial dedicated to pin 14 also... This worked well even though laborious without a library but it wouldn't display the sensor float values!

The only problem i can see is when the preheater or reactor is switch on from ambient causing a fast increase in temp the buttons will become useless again

I've even used the noInterrupt function around the button code but this also failed to improve them!