Last active
November 8, 2015 06:52
-
-
Save Wesitos/3868a499446af340d02a to your computer and use it in GitHub Desktop.
funcionamiento basico del RF24L01 con arduino (Usando un LCD I2C en el receptor)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
// https://github.com/tmrh20/RF24 | |
#include <nRF24L01.h> | |
#include <RF24.h> | |
// Conexiones | |
// http://www.bashmodulo.com/arduino/nrf24l01-radio-frequency-transmitter-receiver-on-arduino/ | |
#define CE_PIN 9 | |
#define CSN_PIN 10 | |
const uint64_t pipe = 0xE8E8F0F0E1LL; | |
RF24 radio(CE_PIN, CSN_PIN); | |
unsigned long data; | |
void setup() | |
{ | |
radio.begin(); | |
radio.openWritingPipe(pipe); | |
} | |
void loop() | |
{ | |
data = millis(); | |
radio.write( &data , sizeof(data)); | |
delay(500); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
// https://github.com/tmrh20/RF24 | |
#include <nRF24L01.h> | |
#include <RF24.h> | |
// Conexiones | |
// http://www.bashmodulo.com/arduino/nrf24l01-radio-frequency-transmitter-receiver-on-arduino/ | |
#define CE_PIN 9 | |
#define CSN_PIN 10 | |
// LCD I2C | |
#include <Wire.h> | |
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address | |
const uint64_t pipe = 0xE8E8F0F0E1LL; | |
RF24 radio(CE_PIN, CSN_PIN); | |
unsigned long data; | |
void setup(){ | |
// LCD I2C | |
lcd.begin(16,2); | |
lcd.setCursor(0,0); | |
// Esperemos un rato al emisor | |
delay(1000); | |
lcd.println("Nrf24L01 Receiver Starting"); | |
radio.begin(); | |
radio.openReadingPipe(1,pipe); | |
radio.startListening(); | |
} | |
void loop(){ | |
if ( radio.available() ){ | |
while (radio.available()){ | |
radio.read( &data, sizeof(data) ); | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("T="); | |
lcd.print(data); | |
} | |
} | |
else{ | |
Serial.println("No radio available"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment