ESP8266 receivedata

Ask, and ye shall receive.
Posts: 4
Joined: 22:03, 27 Jan 2016

ESP8266 receivedata

Postby kosmonout » 19:19, 04 Feb 2016

Hi there,

Started to adapt the java script section of the esp8266 code to my needs. Unfortunately JS is somewhat new too me. I like to pickup TCP status text send by the 8266 (implemented and verified that it is working) and show that on the evo app. So, I need a event driven routine that read outs the tcp buffer. I copied and paste something like this:

Code: Select all

app.receivedData = function (data) {
   if (app.connected) {
      var data = new Uint8Array(data);

      if (data[0] === "A") {
      } else if (data[0] === "U") {

      console.log('Data received: [' + data[0] + ', ' + data[1] + ', ' + data[2] + ']');
   } else {
      // Disconnect and show an error message to the user.

      // Write debug information to console
      console.log('Error - No device connected.');

Probably there is more setup to do. Because it does not work........

Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: ESP8266 receivedata

Postby Fredrik » 03:55, 06 Feb 2016

I assume you mean that your function app.receivedData() is never called.

You'll then need to add this line to the end of the app.js file:

Code: Select all

chrome.sockets.tcp.onReceive.addListener(function(info) { app.receivedData(; });

Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 15 guests