diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c7b49ee --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Arduino/libraries/* \ No newline at end of file diff --git a/Arduino/receiver_code/receiver_code.ino b/Arduino/receiver_code/receiver_code.ino new file mode 100644 index 0000000..0eab911 --- /dev/null +++ b/Arduino/receiver_code/receiver_code.ino @@ -0,0 +1,27 @@ +#include +#include +#include + +RF24 radio(3, 2); // CE, CSN + +const byte address[6] = "00001"; + +void setup() { + Serial.begin(9600); + + radio.begin(); + radio.openReadingPipe(0, address); + radio.setPALevel(RF24_PA_MAX); + radio.startListening(); +} + +void loop() { + if (radio.available()) { + char text[32] = ""; + + radio.read(&text, sizeof(text)); + + Serial.print("recieved: "); + Serial.println(text); + } +} diff --git a/Arduino/transmitter_code/transmitter_code.ino b/Arduino/transmitter_code/transmitter_code.ino new file mode 100644 index 0000000..d248420 --- /dev/null +++ b/Arduino/transmitter_code/transmitter_code.ino @@ -0,0 +1,22 @@ +#include +#include +#include + +RF24 radio(3, 2); // CE, CSN + +const byte address[6] = "00001"; + +void setup() { + Serial.begin(9600); + + radio.begin(); + radio.openWritingPipe(address); + radio.setPALevel(RF24_PA_MAX); + radio.stopListening(); +} + +void loop() { + const char text[] = "Hello World"; + + radio.write(&text, sizeof(text)); +}