Photon to Photon tx/rx communication not working

Hi everyone, I’m new to the Photon so if I ask something dumb well, you get the point.
Anyways, I’m using my 2 photons, and I can’t get them to talk to each other over serial…

On Photon A I have my code simply like this:

void setup()
{
  Serial.begin(9600);
  Serial.println("Hello World!");
}//This is from Particle Reference

void loop(){
}

Now shouldn’t any value I write automatically be written to tx and the CLI? Well it will write to the CLI, but seemingly not over tx which is what is not working… This is my communication Photon A tx -> Photon B rx
Now on Photon B I have a code like this to read the data on Photon B’s rx:

int incomingByte = 0;   

void setup() {
        Serial.begin(9600);     
}

void loop() {

        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received, ");
                Serial.println(incomingByte, DEC);
        }//From the arduino forum
}

now that’s on Photon B so shouldn’t that receive Hello World! and write that in the CLI? If I didn’t clarify something enough just ask and I’ll answer as soon as I can. -Thanks

If you are using tx and rx pins use Serial1 not Serial. Serial is for communication via USB.
For example Serial1.begin(9600) etc…
https://docs.particle.io/reference/firmware/photon/#serial

2 Likes

Thanks @antdem it works great and is a big help!

Great, glad to have helped.