-
• #2
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]); } onInit(); dataLine = ""; setInterval(function() { while (nrf.dataReady()) { var data = nrf.getData(); for (var i in data) { var ch = data[i]; if (ch===0 && dataLine!=="") { console.log(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);
-
• #3
Hi,
i guess the api has changed a little bit. You can see the change in the following commit:
https://github.com/espruino/EspruinoDocs/commit/e1b6dd998d6d3a6d6d5466dcdcc5d4a70b8ecc4f
Try:
while (nrf.getDataPipe() !== undefined) {}
-
• #4
Many thanks will give it a try.
Hi,
Following the tutorial here: http://www.espruino.com/Wireless+Temperature+Sensor
However I get:
Uncaught Error: Function "dataReady" not found!
at line 2 col 14
while (nrf.dataReady()) {
Looking at the code here: http://www.espruino.com/modules/NRF24L01P.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?
Thanks
R