I'm currently using a 2 NRF24L01 to send data from one Arduino to another.
Apparently i can only send 16 diferrent values but i need to send 25 at the same time.
Is there anything i can do to send 25 differente values at the same time?
How are you sending those sixteen?
What are your different values? Are they bytes, integers, long integers, floats?
Post what you've tried and what did or didn't work.
i send a vector with 25 integers but the receiver can only read the first 16 integers of that vector.
It is well documented that the maximum packet size is 32 bytes (16 int data type). If you want to send more than 32 bytes you must do it in multiple 32 byte chunks (sends). That is a hardware limitation not a library limitation so can't be changed.
There is no other component like the NRF24L01 capable of sending more then 32 bytes?
The RFM69 module can send more than 32 bytes.
griffn:
There is no other component like the NRF24L01 capable of sending more then 32 bytes?
What is the reason you can't split the data into two and send one after the other?
To split the information is basically sending 2 separate vectors like this?
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
int S0 = 2;
int S1 = 3;
int S2 = 4;
int pinbat = 5;
int pinMux1 = A0;
int pinMux2 = A1;
int pinMux3 = A2;
int pinMux4 = A3;
int pinMux5 = A4;
int bat = A5;
int mux1[15];
int mux2[10];
void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(pinbat, OUTPUT);
pinMode(pinMux1, INPUT);
pinMode(pinMux2, INPUT);
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
LerMux();
bateria();
radio.write(mux1, sizeof(mux1));
radio.write(mux2, sizeof(mux2));
}
griffn:
To split the information is basically sending 2 separate vectors like this?
Yes but it would probably be a good idea to have a little time between the two transmissions to allow the receiving Arduino to store the data.
You should also allow some time between successive pairs of transmission - maybe 5 pairs per second would be sufficient.
You have not told us what is the range of values in each number. Maybe you don't need to use int (2 byte) variables for all of them?
Each number in each position of the vector varies between 230 and 860.
Each number comes from an analog sensor.
So, if you wanted to do some bit twiddling, you could store each value in ten bits. It would then fit in one transmission. More coding work though.
Does it work for the 25 diferent values?
And if so how would I do that?
You would need to use bitwrite. It's a bit fiddly, is there any reason why two transmissions are a problem?
Last time i tried to send two transmissions the values from one vector swap with the values of the other vector.
I´m using time cycles and maybe that happen because of those time cycles.
I would suggest sending two. Put something different at the start of each one so you know which is which.
And in the receiver code do I put like this?
void setup() {
for(int i = 2; i<9; i++){
pinMode(i, OUTPUT);
}
pinMode(22, OUTPUT);
pinMode(24, OUTPUT);
pinMode(26, OUTPUT);
desligar();
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
if (radio.available()) {
radio.read(mux1, sizeof(mux1));
radio.read(mux2, sizeof(mux2));
griffn:
Each number in each position of the vector varies between 230 and 860.
Each number comes from an analog sensor.
That's a range of 630. Would you actually lose a lot of value if you were to scale it to a range of 255?
What is the sensor measuring?
What is the receiving Arduino using the data for?
...R
Yes. I need that range to differentiate chess pieces with a magnet inside and 2 different chess boards.
I´m using some analog magnetic sensors.
The receiver Arduino will use this data by showing on a display the initial of the piece and it´s coordinates.
griffn:
Yes. I need that range to differentiate chess pieces with a magnet inside and 2 different chess boards.
I´m using some analog magnetic sensors.
The receiver Arduino will use this data by showing on a display the initial of the piece and it´s coordinates.
Presumably the sensor value can be translated into a position on one of the 64 squares on the chess board. So why not do that conversion on the TX Arduino and just send the numbers of the squares?
...R