Hey everyone,i am new to Arduino.I have one Arduno Uno and one Nano with 2 NRf24l01.With using a potentiometer i want to dim or light up the LED on the other Arduino.The problem is i have problem sending the pot data from one to the other arduiono.Well,i can see the pot values of the transmitter from serial monitor and they are true but i don't get anything on the receiver.I belive i should use "unsigned long int" but eventhough i tried a few times i failed.Thanks.Also i will add LEDs later so i don't have anything about them on the code as my problem now is transmitting the pot values.I would appreciate any help.
This is the transmitter:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 radio(9,10);//radio sinyali vericisini aktifle?tiriyo,9-10.pinler
int msg[1];
const uint64_t pipe = 0xE8E8F0F0E1LL;
int outputValue;
void setup(void){
Serial.begin(9600);//gönderdi?i frekans hep sabit
radio.begin();//radioyu ba?lat?yo
radio.openWritingPipe(pipe);}//yazd??? veriyi d??ar? aktarma
void loop(void){
int POT= analogRead(A0);
outputValue = map(POT, 0, 1023, 0, 255);
msg[1]=outputValue;
Serial.println(POT);
radio.write(msg, 1);}
and this is the receiver:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];//mesaj? integer olarak tan?ml?yor
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;//library içinde var
void setup(void){
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe); //gelen sinyali alg?lamaya ba?l?yor
radio.startListening(); //dinlemeye ba?l?yor,sinyal ar?yor
}
void loop(void){
if (radio.available()){ //e?er bir sinyal varsa
bool done = true; //done sorgusu do?ruyken
while (true){ //e?er donesa
done = radio.read(msg, 1); //done i?lemi radio mesaj?n? okumak
Serial.println(msg[0]); //mesaj? yazd?r?yor
}
}
}