I am trying to send data from one node mcu to another using the same wifi for now. I can publish the data since I can see it from my pubnub analytics but not able to receive the data. When I used 2 different node mcu then receiver node mcu just showed random symbols on serial port reading so I am testing below code on just one node mcu for now.


    sprintf(buf, "\"%d\",\"%d\",\"%d\",\"%d\",\"%d\"", shoulder_yaw, shoulder_pitch, biceps_variable, biceps_roll, arm_pitch);

    Serial.println("buf: "); Serial.print(buf);

    PubNonSubClient *pclient = PubNub.publish(pubchannel, buf);
    if (!pclient) return;
    PublishCracker cheez;

    Serial.print("Outcome: "); Serial.print(cheez.outcome());
    Serial.print(' '); Serial.println(cheez.to_str(cheez.outcome()));
    Serial.print("description: "); Serial.println(cheez.description());
    Serial.print("timestamp: "); Serial.println(cheez.timestamp());
    Serial.print("state: "); Serial.print(cheez.state());
    Serial.print(' '); Serial.println(cheez.to_str(cheez.state()));

    PubSubClient *sclient = PubNub.subscribe(subchannel);
    if (!sclient) return; // error
    String msg;
    SubscribeCracker ritz(sclient);
    while (!ritz.finished()) {
        if (msg.length() > 0) {
            Serial.print("Received: "); Serial.println(msg);

On my pubnub account, i am able to send and receive data but its not showing on com port. Does anyone know what is the problem here?

com port

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.