Two Arduino Serial Communication -Missing or Slow

Hi trying to connect two Arduino's - Mega & Uno in serial communication. Pressing KEY"s Connected with UNO and UNO as serial code sender and Mega as receiver and transmitter to pc . testText() it's call function it's having display code line . without testText () call function serial communication working properly but with testText() PC receiving slowly . How to enable the Interrupt activation when there is serial data Arrived - Serial Interrupt and how to make sure receiver not missing any receiving codes from receiver ```
void loop(void) {

if (Serial2.available()) {

c =;




Why don't you show the testText() code if you identified it as the trouble maker?

There is no Serial interrupt. Do you mean serialEvent()?

void testText(void){
  u8g.drawStr( 2, 60, "key1  key2  key3  key4 ");
  u8g.setPrintPos(10, 25);
  u8g.setPrintPos(112, 10); 
  u8g.setPrintPos(16, 10);
  u8g.drawStr( 72, 10, "T=       C");
  u8g.drawStr(2,10, "Test:          "); 
  u8g.setPrintPos(86, 10);    
  temperatureValue= (0.045*sensorValue);  

Serial Event is kind of serial capture ?

the Uno Serial port is already being used by the PC.

you could try powering the Uno independently (USB charger) and monitoring the activity on the Mega connected to the PC

----------  Mega

loop (void)
    if (Serial.available ()     // from PC
        Serial2.print (;

    if (Serial2.available ()    // from UNO
        Serial.print (;

----------  UNO

loop (void)
    if (Serial.available ()
        Serial.print (;   // echo back

Split testText() into multiple functions that do simple things quickly so that incoming characters can be processed in between. In general you can print the empty form in one function, called in setup(), and in another function only update the temperatureValue field. Then call the update function whenever the temperature has changed.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.