Go Down

Topic: Connecting Xbees with Arduinos (Read 1 time) previous topic - next topic

PaulS

Code: [Select]
void loop() {
  // put your main code here, to run repeatedly:
  while(1)
  {
  delay(1000);
  mySerial.write(0x03);
  delay(1000);
  Serial.print('D');
  delay(1000);
  Serial.write(0x31);
  mySerial.print('F');
  delay(1000);
}
}

Do you really no understand that loop() already loops?

Code: [Select]
  if (Serial.available() > 0) {
                // read the incoming byte:
                delay(1000);
                incoming = Serial.read();
                delay(1000);
                Serial.print(incoming);
                delay(1000);
                incoming= mySerial.read();
                delay(1000);
                mySerial.print(incoming);
                delay(1000);
               

       }

If there is data on the hardware serial port that has not been read, it is NOT OK to read from the XBee.
The art of getting good answers lies in asking good questions.

Go Up