Difference between revisions of "Nrf24L01-2.4GHz-ExampleSketches"

From ArduinoInfo
Jump to: navigation, search
m
m (Text replacement - "http://https://" to "https://")
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
Start with our overall [[Nrf24L01-2.4GHz-HowTo|nRF24L01 Information and How-To HERE]] to make sure you connect the nRF24L01 modules correctly. Consider using one of the [[http://yourduino.com/sunshop2/index.php?l=product_detail&p=467|"base modules"]] to get stable 3.3V DC power to your modules. Otherwise consider soldering capacitors across Vcc and Gnd on your modules. See the How-To..
 
Start with our overall [[Nrf24L01-2.4GHz-HowTo|nRF24L01 Information and How-To HERE]] to make sure you connect the nRF24L01 modules correctly. Consider using one of the [[http://yourduino.com/sunshop2/index.php?l=product_detail&p=467|"base modules"]] to get stable 3.3V DC power to your modules. Otherwise consider soldering capacitors across Vcc and Gnd on your modules. See the How-To..
  
Below are the different examples as they are written and tested here. Click on the names below. There are also many examples that come with the RF24 library and you can see them [https://github.com/nRF24/RF24/tree/master/examples| HERE]
+
Below are the different examples as they are written and tested here. Click on the names below. There are also many examples that come with the RF24 library and you can see them [https://github.com/nRF24/RF24/tree/master/examples RIGHT HERE]
[https://mediawiki.org MediaWiki]
+
 
 
----
 
----
 
#[[Nrf24L01-2.4GHz-ExampleSketches#bm1|BARE MINIMUM EXAMPLE]]</span>
 
#[[Nrf24L01-2.4GHz-ExampleSketches#bm1|BARE MINIMUM EXAMPLE]]</span>
Line 22: Line 22:
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - CONNECTIONS: nRF24L01 Modules See:</font>
 
<font color="#95A5A6">  - CONNECTIONS: nRF24L01 Modules See:</font>
<font color="#95A5A6">  </font><u><font color="#95A5A6">http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo</font></u>
+
<font color="#95A5A6">  </font><u><font color="#95A5A6">https://arduinoinfo.mywikis.net/wiki/Nrf24L01-2.4GHz-HowTo</font></u>
 
<font color="#95A5A6">  Uses the RF24 Library by TMRH2o here:</font>
 
<font color="#95A5A6">  Uses the RF24 Library by TMRH2o here:</font>
 
<font color="#95A5A6">  </font><u><font color="#95A5A6">https://github.com/TMRh20/RF24</font></u>
 
<font color="#95A5A6">  </font><u><font color="#95A5A6">https://github.com/TMRh20/RF24</font></u>
Line 98: Line 98:
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - CONNECTIONS: nRF24L01 Modules See:</font>
 
<font color="#95A5A6">  - CONNECTIONS: nRF24L01 Modules See:</font>
<font color="#95A5A6">  </font><u><font color="#95A5A6">http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo</font></u>
+
<font color="#95A5A6">  </font><u><font color="#95A5A6">https://arduinoinfo.mywikis.net/wiki/Nrf24L01-2.4GHz-HowTo</font></u>
 
<font color="#95A5A6">  Uses the RF24 Library by TMRH2o here:</font>
 
<font color="#95A5A6">  Uses the RF24 Library by TMRH2o here:</font>
 
<font color="#95A5A6">  </font><u><font color="#95A5A6">https://github.com/TMRh20/RF24</font></u>
 
<font color="#95A5A6">  </font><u><font color="#95A5A6">https://github.com/TMRh20/RF24</font></u>
Line 188: Line 188:
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - CONNECTIONS:</font>
 
<font color="#95A5A6">  - CONNECTIONS:</font>
<font color="#95A5A6">  - nRF24L01 Radio Module: See </font><u><font color="#95A5A6">http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo</font></u>
+
<font color="#95A5A6">  - nRF24L01 Radio Module: See </font><u><font color="#95A5A6">https://arduinoinfo.mywikis.net/wiki/Nrf24L01-2.4GHz-HowTo</font></u>
 
<font color="#95A5A6">  1 - GND</font>
 
<font color="#95A5A6">  1 - GND</font>
 
<font color="#95A5A6">  2 - VCC 3.3V !!! NOT 5V</font>
 
<font color="#95A5A6">  2 - VCC 3.3V !!! NOT 5V</font>
Line 356: Line 356:
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - SEE the comments after "//" on each line below</font>
 
<font color="#95A5A6">  - CONNECTIONS:</font>
 
<font color="#95A5A6">  - CONNECTIONS:</font>
<font color="#95A5A6">  - nRF24L01 Radio Module: See </font><u><font color="#95A5A6">http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo</font></u>
+
<font color="#95A5A6">  - nRF24L01 Radio Module: See </font><u><font color="#95A5A6">https://arduinoinfo.mywikis.net/wiki/Nrf24L01-2.4GHz-HowTo</font></u>
 
<font color="#95A5A6">  1 - GND</font>
 
<font color="#95A5A6">  1 - GND</font>
 
<font color="#95A5A6">  2 - VCC 3.3V !!! NOT 5V</font>
 
<font color="#95A5A6">  2 - VCC 3.3V !!! NOT 5V</font>

Latest revision as of 17:20, 4 February 2019

Nrf24L01-2.4GHz-ExampleSketches

These are example Arduino software sketches that show how to use the nRF24L01 radio modules. Start with our overall nRF24L01 Information and How-To HERE to make sure you connect the nRF24L01 modules correctly. Consider using one of the ["base modules"] to get stable 3.3V DC power to your modules. Otherwise consider soldering capacitors across Vcc and Gnd on your modules. See the How-To..

Below are the different examples as they are written and tested here. Click on the names below. There are also many examples that come with the RF24 library and you can see them RIGHT HERE


  1. BARE MINIMUM EXAMPLE</span>
  2. TRANSMIT JOYSTICK POSITION DATA TO ANOTHER ARDUINO WITH 2 SERVOS

Bare Minimum example:

This is not a very good example for practical use, but it details the few minimum things you need to do to create radio sketches that work for nRF24L01 Transmit and Receive. Copy and paste these examples into a BLANK window on your Arduino IDE. VERIFY to check them out. You NEED the RF24 library downloaded and installed. See the How-To.

nRF24L01-SimpleTransmit-01

Error: Invalid hash.

nRF24L01-SimpleReceive-01

Error: Invalid hash.

TRANSMIT JOYSTICK POSITION DATA TO ANOTHER ARDUINO WITH 2 SERVOS

These examples include a full round-trip error checking and acknowledge system. They use many of the features of the nRF24L01 Radios and the RF24 Library by TMRH2O such as setting the channel frequency and the power output level. They print the activity and data received on the Serial Monitor at 115200 speed.

    • OPTIONS:** //**Hardware**// - This version defaults to using fixed data with no required Joystick or Servos, for test purposes. There is a variable in both sketches called 'hasHardware' which is set to 'false'. When you have joystick and/or servo hardware connected then set hasHardware = true;
    • OPTIONS: //Radio RF Power Level//** - If you get your radios communicating OK and you think you have good 3.3V power, you can set the RF Power Amplifier to "RF24_PA_MAX". It is initially set to "RF24_PA_LOW" to be less sensitive to poor 3.3V power. See This Page about nRF24L01 problems, power solutions. We strongly recommend the 'base modules' to get reliable information.
    • SERVOS:** Servos draw a lot of current and will **not** work when the Arduino is powered from USB. You must use some external 5V power supply for the servos. The YourDuino RoboRED pictured on the How-to page has a built-in 5V 2A power supply that can run 2 servos when the External power connector is supplied with 9 to 12V.

SKETCH: JOYSTICK DATA TRANSMITTED TO ANOTHER ARDUINO

(Cut and paste into a blank Arduino IDE window)

Error: Invalid hash.



SKETCH: JOYSTICK DATA RECEIVED FROM ANOTHER ARDUINO

(Cut and paste into a blank Arduino IDE window)

Error: Invalid hash.

zz