Arduino to ESP8266 Huzzah Software Serial

Hi everyone, I am trying to communicate with my ESP8266 via softwareserial on my arduino. I believe I have to coding down on the Arduino side, however with the ESP I'm not so sure. I would like to take the data received, which in this case will be a temperature, and send it via MQTT. I can connect to WiFi and MQTT fine, its just reading the serial data and creating a client.publish to send it. Can anyone help.

For ESP8266 software serial, you could try here: https://github.com/plerup/espsoftwareserial

So I'm trying to understand the example you provided. Anytime the ESP reads "ch" on serial it will print ch?

If you mean the example below taken from the supplied link, in setup() it is writing about 90 characters ( …0…9…A…Za…z) to the software serial pins. In the loop, it is mirroring between the standard serial pins and the software serial pins.

If that doesn’t help you, then it may be better to post the code you have already written together with a schematic (even hand drawn) showing the devices and their interconnections, then it may be clearer what problems you still have.

#include <SoftwareSerial.h>

SoftwareSerial swSer(14, 12, false, 256);

void setup() {
  Serial.begin(115200);
  swSer.begin(115200);

  Serial.println("\nSoftware serial test started");

  for (char ch = ' '; ch <= 'z'; ch++) {
    swSer.write(ch);
  }
  swSer.println("");

}

void loop() {
  while (swSer.available() > 0) {
    Serial.write(swSer.read());
  }
  while (Serial.available() > 0) {
    swSer.write(Serial.read());
  }

}

Attached is what I have for code so far. I need to know how to read the temp from the serial data coming from my arduino, and publish it via MQTT. My ESP8266 Huzzah is connected to the arduino on the TX and RX pins.

ESP_trial.ino (1.17 KB)

OK. So you are using the Arduino development environment to program your ESP8266. I guess you have ruled out the option of connecting the temperature sensor directly to the ESP8266 ? Anyway, if you are building a serial connection between an Arduino and an ESP8266, you are not alone: https://www.google.ch/?gws_rd=ssl#newwindow=1&q=communicate+between+arduino+and+esp8266+using+serial+

I'm using the temp sensor attached to the arduino because I have a 2.8inch touch screen that I am using to display the temp and also adjust it. The touch screen is an adafruit that is designed to mount right to the arduino, that would make it hard to connect to the ESP.

Anyone out there have any guidance for me? I would like the esp to read the incoming serial and if the first byte is a certain word then read the second byte and I will use the second byte to publish to mqtt. The arduino will serial.println("Attic") then serial.println("75"), I want the esp to read the attic first then 75 and it will publish 75 to topic attic/temp.