RF24Audio  v1.0
Arduino Audio Streaming Realtime with NRF24L01 radios
 All Classes Files Functions Pages
Public Member Functions | List of all members
RF24Audio Class Reference

TMRh20 2014 - RF24Audio: Arduino Realtime Audio Streaming library. More...

#include <RF24Audio.h>

Public Member Functions

 RF24Audio (RF24 &_radio, byte radioNum)
 Setup the radio and radio identifier. More...
 
void begin ()
 Initialize the radio and audio library. More...
 
void volume (bool upDn)
 Volume Control. More...
 
void setVolume (char vol)
 Volume Control. More...
 
void transmit ()
 Control transmission through code. More...
 
void receive ()
 Stop transmission through code. More...
 
void broadcast (byte radioID)
 Control of Private or Public Communication. More...
 
uint64_t getAddress (byte addressNo)
 Get any of the preset radio addresses. More...
 

Detailed Description

TMRh20 2014 - RF24Audio: Arduino Realtime Audio Streaming library.

This class implements an Audio Streaming library using nRF24L01(+) radios driven by the Optimized RF24 library. https://github.com/TMRh20/RF24

Examples:
GettingStarted.ino, Minimal.ino, PrivateChannels.ino, and PrivateGroups.ino.

Constructor & Destructor Documentation

RF24Audio::RF24Audio ( RF24 &  _radio,
byte  radioNum 
)

Setup the radio and radio identifier.

Note
Changing radioNum is only required if utilizing private node-to-node communication as opposed to broadcasting to the entire radio group
RF24 radio(48,49); // Initialize the radio driver
RF24Audio rfAudio(radio,0); // Initialize the audio driver
Parameters
_radioThe underlying radio driver instance
radioNumThe radio identifier

Member Function Documentation

void RF24Audio::begin ( )

Initialize the radio and audio library.

Generally called in setup to initialize the radio

rfAudio.begin();
void RF24Audio::broadcast ( byte  radioID)

Control of Private or Public Communication.

Call this function to establish private communication between nodes in a radio group, or to switch back to public transmission.

Note
Using a radioID of 255 will disable private communication and broadcast to all nodes
rfAudio.broadcast(1); // Only transmit audio to radio number 1
rfAudio.broadcast(255); // Transmit audio to all radios in the group
Parameters
radioIDSet the radioID of the radio to communicate privately with.
uint64_t RF24Audio::getAddress ( byte  addressNo)

Get any of the preset radio addresses.

Useful for listening nodes who wish to create private or additional radio groups The library has 14 predefined radio addreses. All radios listen/write on the first two addresses (0,1), and engage a private channel based on the radio number. Radio 0 listens on address 2, Radio 1 on address 3, etc.

uint64_t newAddress = rfAudio.getAddress(3); // Gets the 3rd defined radio address
OR
radio.openReadingPipe(0,rfAudio.getAddress(7)); // Listens on the 7th defined radio address
Parameters
addressNoNumbers 0 through 14 to access any part of the defined address array
Returns
RadioAddress: Returns the requested predefined radio address
void RF24Audio::receive ( )

Stop transmission through code.

rfAudio.receive(); // Stop audio streaming

Call this function to stop transmission

void RF24Audio::setVolume ( char  vol)

Volume Control.

rfAudio.setVolume(4); // Set the volume to mid-level
Parameters
volSet at 0 to 7 for range of volume control
void RF24Audio::transmit ( )

Control transmission through code.

rfAudio.transmit(); // Begin realtime audio streaming

Call this function to begin transmission

void RF24Audio::volume ( bool  upDn)

Volume Control.

rfAudio.volume(1); // Raise the volume
Parameters
upDnSet 0 to lower volume, 1 to raise volume

The documentation for this class was generated from the following file: