Created
May 30, 2016 16:37
-
-
Save TURBULENTE/74abc746c266f23940d0d4397f3d5d2b to your computer and use it in GitHub Desktop.
nrf24L01 tests
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));*/ | |
char stringOne[32] = {0}; | |
radio.read(&stringOne, sizeof(stringOne)); | |
Serial.println(stringOne); | |
} | |
} |
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!"; | |
String stringOne; | |
stringOne = String(poten,DEC); | |
/*byte valore [] = {B11110000, B1000000};*/ | |
/* const char text1[] = stringOne;*/ | |
/*radio.write(&text, sizeof(text));*/ | |
/*radio.write(&valore, sizeof(valore));*/ | |
/*const char string_test[] = stringOne;*/ | |
radio.write(&stringOne, sizeof(stringOne)); | |
Serial.println(stringOne); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment