Created
May 30, 2016 16:50
-
-
Save TURBULENTE/9b819784b424d934e7342e4d1875e029 to your computer and use it in GitHub Desktop.
Hola radiocomunicación! + nrf24L01+
This file contains 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> | |
#include <nRF24L01.h> | |
#include <RF24.h> | |
RF24 radio(7, 8); | |
const byte rxAddr[6] = "00001"; | |
void setup() | |
{ | |
while (!Serial); | |
Serial.begin(9600); | |
radio.begin(); | |
radio.openReadingPipe(0, rxAddr); | |
radio.startListening(); | |
} | |
void loop() | |
{ | |
if (radio.available()) | |
{ | |
char text[32] = {0}; | |
radio.read(&text, sizeof(text)); | |
Serial.println(text); | |
} | |
} |
This file contains 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> | |
#include <nRF24L01.h> | |
#include <RF24.h> | |
RF24 radio(7, 8); | |
const byte rxAddr[6] = "00001"; | |
byte poten; | |
void setup() | |
{ | |
Serial.begin(9600); | |
radio.begin(); | |
radio.setRetries(15, 15); | |
radio.openWritingPipe(rxAddr); | |
radio.stopListening(); | |
} | |
void loop() | |
{ | |
poten=analogRead(A0); | |
const char text[] = "Hola radiocomunicación!"; | |
radio.write(text,sizeof(text)); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment