You are reading a single comment by @tambeb and its replies. Click here to read the full conversation.
  • Apologies for asking my first question and then going M.I.A. for a week. Bad form on my part.

    In any case, here's a bit of code for a "beacon" Pico, with the receiver Pico having essentially the same code. As it is here it runs fine, but if I switch over to the commented out software SPI portion, I get a "TX timeout". I've tried on multiple Pico/NRF24 combos so it shouldn't be a hardware issue.

    Thanks for taking a look!

    SPI1.setup( { sck: B3, miso: B4, mosi: B5 } );
    var nrf = require( "NRF24L01P" ).connect( SPI1, B6, B7 );
    
    //var spi = new SPI();
    //spi.setup( { sck: A1, miso: A3, mosi: A2 } );
    //var nrf = require( "NRF24L01P" ).connect( spi, A0, A10 );
    
    var ledValue = 1;
    var dataLine = "";
    
    function onInit() {
       clearInterval();
       nrf.init( [0, 0, 0, 0, 1], [0, 0, 0, 0, 2] );
       sendData( 'PING' );
    }
    
    function sendData( value ) {
       digitalWrite( LED2, ledValue );
       ledValue = !ledValue;
       nrf.sendString( value );
       setTimeout( sendData, 2000, 'PING' );
    }
    
    function receive() {
       dataLine = "";
       while ( nrf.getDataPipe() !== undefined ) {
          var data = nrf.getData();
          for ( var i in data ) {
             var ch = data[i];
             if ( ch === 0 && dataLine !== "" ) {
                console.log( dataLine );
                if ( dataLine == 'PING' ) {
                   digitalWrite( LED2, ledValue );
                   ledValue = !ledValue;
                }
                dataLine = "";
             } else if ( ch !== 0 ) {
                dataLine += String.fromCharCode( ch );
             }
          }
       }
    }
    
    onInit();
    
About

Avatar for tambeb @tambeb started