Code Monkey home page Code Monkey logo

nrflite's Introduction

Transmitter Example

See Basic_TX.ino for a more complete example.

#include <SPI.h>
#include <NRFLite.h>

NRFLite _radio;
uint8_t _data;

void setup()
{
    _radio.init(0, 9, 10); // Set transmitter radio to Id = 0, along with the CE and CSN pins
}

void loop()
{
    _data++; // Change some data.
    _radio.send(1, &_data, sizeof(_data)); // Send to the radio with Id = 1
    delay(1000);
}

Receiver Example

See Basic_RX.ino for a more complete example.

#include <SPI.h>
#include <NRFLite.h>

NRFLite _radio;
uint8_t _data;

void setup()
{
    Serial.begin(115200);
    _radio.init(1, 9, 10); // Set this radio's Id = 1, along with its CE and CSN pins
}

void loop()
{
    while (_radio.hasData())
    {
        _radio.readData(&_data);
        Serial.println(_data);
    }
}

Video Tutorials

  • Tutorial 1 Introduction and all basic features
  • Tutorial 2 2-pin Operation and ATtiny sensor walkthrough

Installation

  • Start the Arduino IDE.
  • Open the Library Manager by selecting the menu item Sketch > Include library > Manage Libraries.
  • Search for 'nrflite'.
  • Select the latest version and click the Install button.
  • View examples in the menu File > Examples > NRFLite.

Features

  • 2-pin operation on ATtiny and ATmega microcontrollers thanks to NerdRalph.
  • 4-pin operation using shared CE and CSN pins while continuing to use the high-speed SPI and USI peripherals of the supported microcontrollers.
  • Operation with or without interrupts using the radio's IRQ pin.
  • ATtiny84/85 support when used with the MIT High-Low Tech library https://github.com/damellis/attiny. This library uses much less memory than https://github.com/SpenceKonde/ATTinyCore and is required for the ATtiny85 sensor example.
  • Small number of public methods. Please see NRFLite.h for their descriptions.
  • No need to enable features like retries, auto-acknowledgment packets, and dynamic packet sizes.
  • No need to add delays or implement timeouts.
  • No long radio addresses to manage.
  • No need to set the transmit power (max is enabled by default).

nRF24L01+ Pin Reference

nRF24L01 Pinout

2-Pin Hookup Guide

  • This mode is much slower than the other hookup options which take advantage of the SPI and USI peripherals of the supported microcontrollers.
  • The resistor and capacitor values should only be adjusted if you have an oscilloscope and are comfortable changing the library.

2-Pin

ATmega328 SPI Hookup Guide

Radio MISO -> Arduino 12 MISO
Radio MOSI -> Arduino 11 MOSI
Radio SCK  -> Arduino 13 SCK
Radio CE   -> Any GPIO Pin (can be same as CSN)
Radio CSN  -> Any GPIO Pin (pin 10 recommended)
Radio IRQ  -> Any GPIO Pin (optional)

Arduino Pin 10 is the SPI Slave Select (SS) pin and must stay as an OUTPUT.

ATmega328 Pinout

ATtiny84 USI Hookup Guide

Radio MISO -> Physical Pin 7
Radio MOSI -> Physical Pin 8
Radio SCK  -> Physical Pin 9
Radio CE   -> Any GPIO Pin (can be same as CSN)
Radio CSN  -> Any GPIO Pin
Radio IRQ  -> Any GPIO Pin (optional)

Arduino pin names (pictured in brown) using the MIT High-Low Tech library https://github.com/damellis/attiny.

ATtiny84 Pinout

ATtiny85 USI Hookup Guide

Radio MISO -> Physical Pin 5
Radio MOSI -> Physical Pin 6
Radio SCK  -> Physical Pin 7
Radio CE   -> Any GPIO Pin (can be same as CSN)
Radio CSN  -> Any GPIO Pin
Radio IRQ  -> Any GPIO Pin (optional)

Arduino pin names (pictured in brown) using the MIT High-Low Tech library https://github.com/damellis/attiny.

ATtiny85 Pinout

nrflite's People

Contributors

bart avatar delph avatar dparson55 avatar gavriluk avatar michalnpl avatar nehpetsde 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.