Bu kablosuz telsiz modülü kolay ve uygun fiyatlı bir ürün olup, düşük maliyetli bir kablosuz haberleşme sistemi kurabilmenize olanak sağlayacaktır. Kolayca kendi MCU / ARM / PIC / AVR / STM32 sistemi ile ekleyebilirsiniz. Dahası, bu NRF24L01 modülü + Güç amplifikatörü ve SMA anten ile tasarlanmıştır ve engelsiz 1000 metreye kadar kablosuz iletişim imkanı sağlamaktadır.
Ürün Özellikleri:
- Frekans: 2.4 GHz ~ 2.5 GHz
- Çalışma Voltajı: 3V ~ 3.6V
- Max Akım: 115mA
- Multi Frekans: 125 Frekans
- 6 kanalın veri alımına kadar desteklemektedir.
- NRF24L modülün konnektörü SMA Dişi konnektörlüdür
- Antenin konnektörü SMA erkek konnektörlüdür.
Paket İçeriği:
- 1 x NRF24L01+PA+LNA
- 1 x SMA Anten
Verici Kodu
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001"; //Byte of array representing the address. This is the address where we will send the data. This should be same on the receiving side.
int button_pin = 2;
boolean button_state = 0;
void setup() {
pinMode(button_pin, INPUT);
radio.begin(); //Starting the Wireless communication
radio.openWritingPipe(address); //Setting the address where we will send the data
radio.setPALevel(RF24_PA_MIN); //You can set it as minimum or maximum depending on the distance between the transmitter and receiver.
radio.stopListening(); //This sets the module as transmitter
}
void loop()
{
button_state = digitalRead(button_pin);
if(button_state == HIGH)
{
const char text[] = "Your Button State is HIGH";
radio.write(&text, sizeof(text)); //Sending the message to receiver
}
else
{
const char text[] = "Your Button State is LOW";
radio.write(&text, sizeof(text)); //Sending the message to receiver
}
radio.write(&button_state, sizeof(button_state)); //Sending the message to receiver
delay(1000);
}
Alıcı Kodu
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
boolean button_state = 0;
int led_pin = 3;
void setup() {
pinMode(6, OUTPUT);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address); //Setting the address at which we will receive the data
radio.setPALevel(RF24_PA_MIN); //You can set this as minimum or maximum depending on the distance between the transmitter and receiver.
radio.startListening(); //This sets the module as receiver
}
void loop()
{
if (radio.available()) //Looking for the data.
{
char text[32] = ""; //Saving the incoming data
radio.read(&text, sizeof(text)); //Reading the data
radio.read(&button_state, sizeof(button_state)); //Reading the data
if(button_state == HIGH)
{
digitalWrite(6, HIGH);
Serial.println(text);
}
else
{
digitalWrite(6, LOW);
Serial.println(text);}
}
delay(5);
}
İncelemeler
Henüz inceleme yapılmadı.