#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
}
So I’m look at this code for an RF24L0I module (Wireless receiver monitor). I don’t really use arrays a lot and I’m kind of confused about the use of [ ] in this code since I know [ ] brackets are generally used for arrays but I don’t see them defining an array
J-M-L
June 3, 2022, 5:27pm
2
If this is this one, it means create an array and let the compiler calculate the size based on the initial value (here a cString)
Ohhhh! That make so much more sense
1. Probably, you are familiar with this type of array declaration:
char myName[] = {'V', 'i', 'c', 't', 'o', 'r', '\0'};
2. The above declaration can also be written as follows:
char myName[] = "Victor"; //Null-character ('\0') is automatically inserted at the end
J-M-L
June 3, 2022, 5:42pm
6
Probably not. I think OP was expecting the size to be provided
Yes! The OP has accepted your answer as the solution.
I gave focus on defining an array of his post.
system
Closed
November 30, 2022, 5:59pm
8
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.