0

I am running a program on an Uno using data that an ESP8266 is sending via Serial (can't run directly on the ESP8266 due to not enough GPIOs) and I'm having a problem where characters like '$' on a webpage come through as '$$amd4'

Here is the relevant code on the ESP8266:

 if ((WiFiMulti.run() == WL_CONNECTED)) {
    WiFiClient client;
    HTTPClient http;
    if (http.begin(client, URLForWebpage)) {  // HTTP

      // start connection and send HTTP header
      int httpCode = http.GET();

      // httpCode will be negative on error
      if (httpCode > 0) {
        // HTTP header has been send and Server response header has been handled
        // file found at server
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          String payload = http.getString();
          Serial.println(payload);
        }
      } else {
        Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
      }

      http.end();
    } else {
      Serial.printf("[HTTP} Unable to connect\n");
    }
  } 

And here is the relevant code on the Arduino Uno where I am seeing the '$$amd4' in the mySerial output:

void loop() {
  if (Serial.available() > 0) {
    receivedChar = Serial.read();
    mySerial.print(receivedChar);
}

It's worth noting that when I connect directly to the ESP8266, I can see the '$' character fine, but not when I read out of mySerial from the Uno after connecting the ESP8266 to the Uno via Serial. Is there something I need to change in the code or on the webpage in order to make this work?

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.