Skip to content

Instantly share code, notes, and snippets.

@giljr
Last active June 4, 2017 00:52
Show Gist options
  • Save giljr/0f741d89e39fb5eb637386bdb6d9046d to your computer and use it in GitHub Desktop.
Save giljr/0f741d89e39fb5eb637386bdb6d9046d to your computer and use it in GitHub Desktop.
See tutorial on https://goo.gl/H8i0rT
/*
Project name: nRF24L0 — Popular RF module using with Arduino ! #arduSerie-33
Studing nRF24L01 radios!
Flavour I - Transmiter Radio
Hex File: _33_nRF24L01_SimpleTransmitRadio.ino
Revision History:
Jun, 2017
- Medium webpage: https://goo.gl/H8i0rT
Description:
This is a simple code to configure a radio transmitter and other receiver
in the simplest possible way!
MCU: Arduino 1.8.2 - @16MHz http://www.arduino.cc/
Radio: nRF24L01 - Unknown version
Connections:
See Official youtube channel vids:
Based on: Connecting and programming nRF24L01 with Arduino and other boards
from http://starter-kit.nettigo.eu/2014/connecting-and-programming-nrf24l01-with-arduino-and-other-boards/
Datasheet Atmega328P 8-bit AVR Microcontrollers:
http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License v3 as published by
the Free Software Foundation
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8);
const byte rxAddr[6] = "00001"; // you can modify this address
// serves to mark each transmission line
void setup()
{
radio.begin(); // initializa the serial interface
radio.setRetries(15, 15); // 15 * 255 = 3.75 milliseconds to retry transmition, 15 tries
radio.openWritingPipe(rxAddr); // open a stream for transmitting the data pipe
radio.stopListening(); // stop the process of listening
}
void loop()
{
const char text[] = "Hello World from J3"; //Send a message
radio.write(&text, sizeof(text)); // write to radio stream
delay(1000); //wait one second
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment