You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Well, the code on GitHub is going to need a bit more work, but in the mean time put this code in, and do each of the commands in comments one after the other:

    Serial4.setup(115200, { rx: C11, tx : C10 });
    var line = "";
    Serial4.on('data',function(c) {
      line += c;
      if (line.substr(0,5)=="+IPD,") {
        // input data
        var colon = line.indexOf(":",5);
        if (colon>=0) {
          var len = parseInt(line.substr(5,colon-5));
          if (line.length-colon > len) {
            console.log("DATA>"+JSON.stringify(line.­substr(colon+1,len)));
            line = line.substr(colon+len+1);
          }
        }
      } else {
        // simple lines
        var i = line.indexOf("\n");  
        while (i>=0) {
          console.log("-->"+line.substr(0,i));
          line = line.substr(i+1);      
          i = line.indexOf("\n");
        }
      }
    });
    
    /*
    Serial4.print('AT+RST\r');
    Serial4.print('AT+CWMODE=1\r');
    Serial4.print('AT+CWJAP="YourAPName","Yo­urAPPass"\r');
    
    Serial4.print('AT+CIPMUX=0'); // single connection
    
    Serial4.print('AT+CIPSTART="TCP","93.93.­135.13",80\r');
    var cmd = "GET / HTTP/1.0\r\n\r\n";
    Serial4.print('AT+CIPSEND='+cmd.length+'­\r');
    Serial4.print(cmd);
    Serial4.print('AT+CIPCLOSE\r');
    
    */
    

    Part of me is wondering if it's not easier to just implement the whole driver in JavaScript :)

About

Avatar for Gordon @Gordon started