Git Product home page Git Product logo

rf24sn_arduino_client's Introduction

RF24SN Arduino Client Library

NOTE: This is a fork! Testing is ongoing.. The following has been changed:

  • Added 1 param to be able to set the data rate. RF24_1MBPS / RF24_2MBPS / RF24_250KBPS

Implements the client side of RF24SN. For full description of protocol, client server setup or alternative implementations, see RF24SN

Installation:

cd /path/to/arduino
cd libraries
git clone https://github.com/VaclavSynacek/RF24SN_Arduino_Client.git

Including the library:

all of these includes are required:

#include <SPI.h>
#include "RF24.h"
#include "RF24SN.h"

Setup

update depending on your wiring setup. With the default wiring described underneath this should be ok:

#define RF24SN_NODE_ID 1
#define RF24SN_SERVER_ADDR 0xF0F0F0F000LL
#define RF24_CE_PIN 9
#define RF24_CS_PIN 10

RF24 radio(RF24_CE_PIN, RF24_CS_PIN);
RF24SN rf24sn( &radio, RF24SN_SERVER_ADDR, RF24SN_NODE_ID, RF24_1MBPS);

void setup(void) {
	rf24sn.begin();
}

Publish Usage:

To send single float value to MQTT broker use publish function:

#define SENSOR_ID 1  //publishes to RF24SN/in/<RF24SN_NODE_ID>/1
       
float measuredValue = 3.14; //replace this line with actual sensor reading code
bool publishSuccess = rf24sn.publish(SENSOR_ID, measuredValue);

Request Usage:

To request single float value from MQTT broker use request function:

#define SENSOR_ID 2  //request last payload fo RF24SN/out/<RF24SN_NODE_ID>/2
       
float requestValue;
bool requestSuccess = rf24sn.request(SENSOR_ID, &requestValue);
if(requestSuccess)
{
   Serial.println(requestValue); //replace this line with some action code (moving servo, LED on, etc.)
}

Wiring

Wiring

The SPI wires (yellow) have to go exactly to their counterparts:

  • MOSI to MOSI
  • MISO to MISO
  • SCK to SC(L)K

The VCC (red) has to go to any 3.3V pin. Connecting it to 5V pin will damage the nRF24L01.

GRN (black) can go to any ground.

The CSN and CE can go to any pin, however it must correspond to the library constructor. All examples are written assuming:

  • CE to pin 9
  • CS(N) to pin 10

Schema

rf24sn_arduino_client's People

Contributors

nidayand avatar vaclavsynacek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.