//Transistor code
#include <SPI.h>
#include "RF24.h"
#include <nRF24L01.h>
#include <printf.h>
RF24 radio(7, 8);
const char text[] = "Happy Day!";
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
printf_begin();
radio.setDataRate( RF24_1MBPS );
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.printDetails();
radio.stopListening();
Serial.println("NRF24L01 deliver");
}
void loop() {
radio.write(&text, sizeof(text));
delay(2000);
}
//Receiver code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
RF24 radio(7, 8); // CE腳, CSN腳
const byte address[6] = "00001"; //節點位址為 5 bytes + \0=6 bytes
void setup() {
Serial.begin(9600);
radio.begin();
printf_begin();
radio.setDataRate( RF24_1MBPS );
radio.openReadingPipe(1, address);
radio.startListening();
radio.printDetails();
Serial.println("nRF24L01 ready!");
}
void loop() {
if(radio.available())
{ char text[32] = "";
radio.read(&text, sizeof(text)); //讀取接收字元}
Serial.println(text);
}
}
the details of transistor:
14:23:59.063 -> SPI Speedz = 10 Mhz
14:23:59.110 -> STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
14:23:59.158 -> RX_ADDR_P0-1 = 0x0000000000 0x0000000000
14:23:59.206 -> RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
14:23:59.253 -> TX_ADDR = 0x0000000000
14:23:59.253 -> RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
14:23:59.301 -> EN_AA = 0x00
14:23:59.349 -> EN_RXADDR = 0x00
14:23:59.349 -> RF_CH = 0x00
14:23:59.349 -> RF_SETUP = 0x00
14:23:59.397 -> CONFIG = 0x00
14:23:59.397 -> DYNPD/FEATURE = 0x00 0x00
14:23:59.444 -> Data Rate = 1 MBPS
14:23:59.444 -> Model = nRF24L01+
14:23:59.492 -> CRC Length = Disabled
14:23:59.492 -> PA Power = PA_MIN
14:23:59.540 -> ARC = 0
14:23:59.540 -> NRF24L01 deliver
the details of transistor:
14:25:05.281 -> SPI Speedz = 10 Mhz
14:25:05.328 -> STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
14:25:05.376 -> RX_ADDR_P0-1 = 0xe7e7e7e7e7 0x3130303030
14:25:05.423 -> RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
14:25:05.470 -> TX_ADDR = 0xe7e7e7e7e7
14:25:05.470 -> RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
14:25:05.519 -> EN_AA = 0x3f
14:25:05.566 -> EN_RXADDR = 0x02
14:25:05.566 -> RF_CH = 0x4c
14:25:05.566 -> RF_SETUP = 0x07
14:25:05.614 -> CONFIG = 0x0f
14:25:05.614 -> DYNPD/FEATURE = 0x00 0x00
14:25:05.662 -> Data Rate = 1 MBPS
14:25:05.662 -> Model = nRF24L01+
14:25:05.662 -> CRC Length = 16 bits
14:25:05.710 -> PA Power = PA_MAX
14:25:05.710 -> ARC = 0
14:25:05.710 -> nRF24L01 ready!