• # This code is not working for me. I tried below code...and tried many ways but not receiving on RX but TX works fine.
    on Espruino v1.99 on NodeMCU

    var status=0;
    function swap() {
    status = !status;
    digitalWrite(NodeMCU.D0, status);
    }
    function onInit()
    {
    Serial1.setup(9600);
    Serial1.on('data', function (data) { swap(); });
    LoopbackA.setConsole();
    }
    //onInit();

  • This is what I tested:

    connect to device with WEB IDE via TCP/IP

    upload this code for a ESP8266 12F

    var status=0;
    function swap() {
        status = !status;
        digitalWrite(NodeMCU.D4, status);
    }
    Serial1.on('data', function (data) { swap(); });
    

    send data over serial with echo > /dev/cu.usbserial

    result every send toggle the onboard led

    Hope this works for you too.

  • Thanks for response ... I'll try and reply soon

  • Hi @MaBe
    Still not working RX....tested with 2 NodeMCUs
    Sir, please mention which espruino firmware you're using and tested this code... Here mine is v1.99

  • This is the setup I used to test

    • Espruino version is 1v99.

    • ESP8266 12F board connect to access point and serial port /dev/cu-usbserial

    • Connect with WEB IDE over TCP/IP to the ESP8266 board

    Question: Does WEB IDE over serial and TCP/IP work for you?

  • Yes, serial and WEB TCP/IP both are working fine to upload code.

    And one more thing I'm using NodeMCU, which runs on the ESP8266.
    I uploaded firmware in it and everything works fine except RX.

    My Thinking about this issue:
    I'm not sure but may be, RX in standalone ESP8266 is accessible but RX in NodeMCU is not accessible, by some hardware reason or RX is busy for some other task.
    or may be bug in v1.99

    Please provide me your exact firmware. (if possible) becaue I'm using 4mb version that may be differ from yours.

  • Please provide me your exact firmware. (if possible) becaue I'm using 4mb version that may be differ from yours.

    Espruino branch: master

    >process.env
    ={
      VERSION: "1v99.4128",
      GIT_COMMIT: "5b447a61",
      BOARD: "ESP8266_4MB",
      FLASH: 0, RAM: 81920,
      SERIAL: "5ccf7fc1-120b",
      CONSOLE: "Telnet",
      MODULES: "Flash,Storage,net" ... "r,crypto,neopixel",
      EXPTR: 1073643636 }
    > 
    

    try this snippet too:

    var status=0;
    var i=0;
    function swap() {
      i++;
      status = !status;
      console.log(i,"data",Date().toString());­
    }
    
    Serial1.on('data', function (data) { swap(); });
    
    
  • please post output of process.env

  • Thanks for you response
    Here process.env response:

    >process.env
    ={
      "VERSION": "1v99",
      "GIT_COMMIT": "f0d66ba",
      "BOARD": "ESP8266_4MB",
      "FLASH": 0, "RAM": 81920,
      "SERIAL": "dc4f2219-9b31",
      "CONSOLE": "Telnet",
      "MODULES": "Flash,Storage,net" ... "r,crypto,neopixel",
      "EXPTR": 1073643636 }
    > 
    

    and nothing happen in console when I typed and uploaded code which is provided by you.
    Here is my connection to NodeMCU

    TTL 5V-----------------------------------Nod­eMCU 5V (VCC IN)
    TTL RX-----------LEVEL SHIFTER----------NodeMCU TX
    TTL TX-----------LEVEL SHIFTER----------NodeMCU RX
    TTL GND---------------------------------Node­MCU GND

    I found somewhere that NodeMCU works without level shifting on RX/TX. So, I tried without level shifter with another NodeMCU and 2 TTL
    All are components are working fine and I think no component is damaged.
    But can't figured out what is the problem.

  • This is what I use: USB to TTL Serial Cable 3,3V and a D-duino ESP8266 12F device.


    1 Attachment

    • IMG_8451.jpg
  • ...on a beech hardwood floor/table... makes me homesick in a good way... so, more precise: recalls lovely memories.

  • Great ... I think, I should try some other board or standalone ESP8266 first...Thanks for all your response but if you found any other information about this please share....thanks-a-lot :)

  • And since it is not solved so I'm not closing this convo, may be someone else may help

    Thanks @MaBe

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

"Serial1.on('data', function (data) {......" not works for me, is works for any other ??

Posted by Avatar for user94070 @user94070

Actions