This page is to Setup and Config nRF24L01
Hardware and Software
Hardware
nRF24L01
Software
Arduino IDE
Notes
- Connect Arduino nano
- CE and CSN can change to any PIN
5V |
3.3V |
CE (Pin 7 / any pin) |
CSN (Pin 8) (Any Pin) |
SCK (Pin 13) |
MOSI (Pin 11) |
MISO ( Pin 12) |
IRQ (---) |
GND |
GND |
- Library Download
- http://www.airspayce.com/mikem/arduino/RadioHead/index.html
- https://github.com/TMRh20/RF24
Examples
This example is .Receive
-
#include <SPI.h>
#include "nRF24L01.h" #include "RF24.h"
RF24 radio(7, 8); const byte rxAddr[6] = "00001";
void setup() { while (!Serial); Serial.begin(9600); radio.begin(); radio.openReadingPipe(0, rxAddr); radio.startListening(); }
void loop() { if (radio.available()) { char text[32] = {0}; radio.read(&text, sizeof(text)); Serial.print("Received : "); Serial.println(text); } else { //Serial.println("No Singal"); //delay(500); } }
Examples
This example is Send
-
#include <SPI.h>
#include "nRF24L01.h" #include "RF24.h" int msg[1]; RF24 radio(7, 8);
const byte rxAddr[6] = "00001";
void setup() { Serial.begin(9600); Serial.println("Start...."); radio.begin(); radio.setRetries(15, 15); radio.openWritingPipe(rxAddr); radio.stopListening(); }
char text[] = "Hello Sanki I'm Here !!"; int counter = 0; void loop() { if (counter <10) { text[0] = '0'; text[1] = char(counter + 97); counter++; } else { counter = 0; } Serial.print("Sending....."); radio.write(&text, sizeof(text)); Serial.print("OK : "); Serial.println(text[1]); delay(500); }
|
 Updating...
Sanki Poon, 2016年5月23日 下午8:25
RadioHead-1.46.zip (313k) Sanki Poon, 2016年5月23日 下午8:25
|