Go Down

Topic: problem with serial communication arduino (Read 640 times) previous topic - next topic

TTU.ABD

I wrote code to connect arduino with pic , I don't want to explain things don't matter, but the main problem is that arduino always receives data although I don't connect any wire to pins(TX3,RX3).
this simple example , I uploaded it to arduino,  and the result is that on terminal monitor
always print "the fire in the room : " .
and sometimes print stranger characters or nothing as shown image in down .
Code: [Select]

char ch;
int index=0;
char i[4];
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
Serial.println("power on");
}

void loop()
{
 while(Serial3.available()>0)
 {
    ch=(char)Serial3.read();
    i[index]=ch;
    index++;
    if (index==3)
{     index=0;
      Serial.println("\n");
      Serial.println("the fire in the room : ");
      Serial.print(i[0]);Serial.print(i[1]);Serial.print(i[2]);  }
 }
}



JeffersonAlmeida

I think that is a baud rate problem, certify the value preseted in the COM port and Arduino software.

Old_guy

Looks like you are picking up noise which is then transmitted...

Go Up