Comments (4)
This is a coding issue, not an issue with the library.
The library will handle a maximum of 32 bytes per payload. Either use multiple payloads, make your payloads smaller, or use RF24Network which supports large payload sizes via fragmentation/reassembly.
from rf24.
This is not a RF24 lib problem, rather it is a combination of misusing c-str data and misunderstanding the hardware limitations of the nRF24L01 radio.
Lets talk c-str data
char humidityStr[6];
Here, you allocate 6 bytes for string to represent a percentage (usually ranging [0, 100]) with 2 decimal places. So, max is 100.00
% (6 characters) and min is 0.00
%. At this point, it is important to note that the hunidityStr
does not have enough capacity for the c-str's required null terminating character ('\0'
) when the float value is at max (100.00
).
Lets talk RF24 payload size
Using RF24, payloads can only be 32 bytes maximum.
# this is 32 characters (32 bytes of UTF-8 encoded data)
2024/05/07 15:02:07 T:25.90°C H:
# this is 38 characters (38 bytes of UTF-8 encoded data)
2024/05/07 15:02:07 T:25.90°C H:48.90%
Increasing the buffer beyond 32 bytes is pointless because the nRF24L01 will only handle payloads with a maximum of 32-bytes. BTW, increasing the size of a buffer of uninitialized bytes does not guarantee that the c-str data will end in a '\0'
because not all compilers use implicit initialization values (that's up the Arduino core you are using for the Uno R4).
Some other hints
- use
if (!radio.begin())
to detect bad radios or incorrect wiring. - using
sprintf()
instead ofdtostrf()
can tell you how many bytes were stored to the c-str. The byte count in turn can be used as the payload length...
from rf24.
thank you much for your reply. Could you please help me? the final project will have 12 sensors in a MEGA board that will be sent to UNO using nrf24. I am begginer.
from rf24.
Sorry, but no. We try to focus on actual library problems here. You could try your luck with Arduino forums.
project will have 12 sensors in a MEGA board that will be sent to UNO using nrf24
Sounds like a good scenario for using RF24Network. It allows for payloads greater than 32 bytes and the network can have hundreds of nodes instead of just 7 nodes. The only obstacle for beginners is understanding the network topology
from rf24.
Related Issues (20)
- Is there a known ESP32 Deep Sleep issue with radio.powerDown()? [Question] HOT 19
- Can RF24 library be used with WiFi? HOT 2
- Can RF24 library be used with WiFi? HOT 4
- [Question] setChannel & setDataRate not read correctly by printPrettyDetails ? HOT 4
- ESP32 Core Panic on radio 0; No panic on Radio number 1, same wiring. How to troubleshoot?[Question] HOT 22
- Use Linux kernel's character device API to implement IRQ capability HOT 113
- [Question] R24.h, testRPD(void) "Strong signal > 64dBm" : "Weak signal < 64dBm" HOT 5
- [Question] Issue using the ManualAcknowledgements.ino HOT 11
- Multiple senders one receiver HOT 1
- reorganize examples HOT 5
- revise MRAA driver's GPIO
- Phasing out most Linux drivers HOT 1
- [Question] Address names used in examples problematic? HOT 8
- Library blocks 11 pin HOT 1
- Unable to use SPI1 on the raspberry pi pico HOT 3
- Problem using stopListening() and startListening() HOT 3
- [Question] Some modules take way longer to write() HOT 6
- can't find RF24 method inside RF24 module HOT 18
- Change `SERIAL_DEBUG` into `RF24_DEBUG` HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rf24.