Go Down

Topic: problem with serial communication arduino (Read 675 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]);  }
 }
}



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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy