NRF24L01P dataReady() Not Found?

Posted on
  • Hi,

    Following the tutorial here:­ture+Sensor

    However I get:

    Uncaught Error: Function "dataReady" not found!
    at line 2 col 14
    while (nrf.dataReady()) {

    Looking at the code here:­P.js

    I cannot see a dataReady function?

    Using an Kickstart Espruino with latest firmware loaded.
    The Slave code is working and trying to send.

    Just the Master code not working

    Any ideas?

  • If it helps here is the code:

    SPI1.setup({sck:B3, miso:B4, mosi:B5});
    var nrf = require("NRF24L01P").connect( SPI1, C5, C4 );
    function onInit() {
      nrf.init([0,0,0,0,2], [0,0,0,0,1]);
    dataLine = "";
    setInterval(function() {
      while (nrf.dataReady()) {
        var data = nrf.getData();
        for (var i in data) {
          var ch = data[i];
          if (ch===0 && dataLine!=="") {
            // we could even save it onto an SD card using require('fs').appendFile("log.txt", dataLine+"\n");
            dataLine = "";
          } else if (ch!==0) {
            dataLine += String.fromCharCode(ch);
    }, 50);
  • Hi,

    i guess the api has changed a little bit. You can see the change in the following commit:­/commit/e1b6dd998d6d3a6d6d5466dcdcc5d4a7­0b8ecc4f

    Try: while (nrf.getDataPipe() !== undefined) {}

  • Many thanks will give it a try.

  • Thanks @possmann - yes, the API changed a few months back and I must have forgotten to update the example. I'll get that changed the next time I update the website.

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

NRF24L01P dataReady() Not Found?

Posted by Avatar for user47955 @user47955