You are reading a single comment by @#kai and its replies. Click here to read the full conversation.
  • Hi Gordon,

    no I did paste the code to the right pane of the WebIDE. The following is what i am doing exactly...
    Left pane right after startup of the WebIDE and connecting to my Espruino board

     Connected
     =undefined
     >trace()
     #1[r1,l1] Object {
       #4[r1,l0] Name: '>timers'  #5[r2,l0] Array [
       ]
       #6[r1,l0] Name: '>watches'  #7[r2,l0] Array [
       ]
       #9[r1,l0] Name: '>history'  #10[r1,l0] Array [
         #11[r1,l0] Name: int 0  #8[r1,l0] String echo(0);
         #14[r1,l0] Name: int 1  #16[r1,l0] String console.log(\"<<\"+\"<<<\"+JSON.stringify(process.env)+\">>>\"+\">>\");
         #25[r1,l0] Name: int 2  #48[r1,l0] String echo(1);
       ]
       #13[r1,l0] Name: 'console'  #12[r1,l0] Function {
       }
       #15[r1,l0] Name: 'JSON'  #21[r1,l0] Function {
       }
       #24[r1,l0] Name: 'process'  #23[r1,l0] Function {
       }
     }  
     =undefined
     > 
    

    Right pane holds the slightly enhanced example code for the NRF24L01P module...

    SPI1.setup({sck:A5, miso:A6, mosi:A7});
    var nrf = require("NRF24L01P").connect(SPI1, B0, B1);
    
    function onInit() {
      print(nrf);
      if (typeof nrf != "undefined") {
        nrf.init([0,0,0,0,1], [0,0,0,0,2]);
        print("NRF Library loaded!");
      } else {
        print("Error! NRF Library not loaded!");
      }
    }
    onInit();
    setInterval(function() {
        nrf.slaveHandler();
    }, 50);
    

    After sending the code to the Espruino the following shows up in the left pane of the WebIDE:

    >reset();
    =undefined
       _____                 _ 
      |   __|___ ___ ___ _ _|_|___ ___ 
      |   __|_ -| . |  _| | | |   | . |
      |_____|___|  _|_| |___|_|_|_|___|
                |_|   http://www.espruino.com
      1v47 Copyright 2014 Gordon Williams
    -------------------------------------------
    >echo(0);
    ERROR: Function not found! Skipping. at line 1 col 32
    var nrf = require("NRF24L01P").connect(SPI1, B0, B1);
                                   ^
    undefined
    Error! NRF Library not loaded!
    =undefined
    ERROR: Using '.' operator on non-object at line 2 col 8
        nrf.slaveHandler();
           ^
    at line 2 col 21
        nrf.slaveHandler();
                        ^
    in function called from system
    ERROR: Using '.' operator on non-object at line 2 col 8
        nrf.slaveHandler();
           ^
    at line 2 col 21
        nrf.slaveHandler();
                        ^
    in function called from system
    ERROR: Using '.' operator on non-object at line 2 col 8
        nrf.slaveHandler();
           ^
    at line 2 col 21
        nrf.slaveHandler();
                        ^
    in function called from system
    ...
    >clearInterval();
    =undefined
    > 
    

    When copying the code for the module from teh Espruino website into the Editor (right pane of the WebIDE) my Espruino also has problems to interpret the Javascript code. Maybe i should use the minified versions to check if it works?
    Anyways, after clearing up all those inline '/..../' style comments the code did work last night, but i got some timing errors on the Espruino console (left pane in WebIDE). Maybe i can reproduce these again tomorrow if it helps.

About

Avatar for #kai @#kai started