Transmitter code to see how i am getting and mapping the values.
#include <Mirf.h>
#include <MirfHardwareSpiDriver.h>
#include <MirfSpiDriver.h>
#include <nRF24L01.h>
#include <SPI.h>
//**************Start Pin Setup***************
int LS_U_D = 3; // analog pin used for the pot Left U/D
//int LS_L_R = 2; // analog pin used for the pot Left L/R
//int RS_U_D = 5; // analog pin used for the pot Right U/D
int RS_L_R = 4; // analog pin used for the pot Right L/R
//**************End Pin Setup***************
//**************Global vars Setup***************
int LS_U_Dval;
//int LS_L_Rval;
//int RS_U_Dval;
int RS_L_Rval;
//**************END vars Setup***************
void setup(){
Serial.begin(57600); // start serial communications
//**************Start Transiever (NRF24L01) config**************
Mirf.cePin = 9;
Mirf.csnPin = 10;
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"clie1");
Mirf.payload = 4 * sizeof(byte);
Mirf.config();
//**************End Transiever (NRF24L01) config**************
Serial.println("Beginning ... "); // Print some stuff to serial
}
void loop(){
//****************************Read Sticks**********************
LS_U_Dval = analogRead(LS_U_D); // set val to read analog pin 2
// LS_L_Rval = analogRead(LS_L_R);// set val to read analog pin 3
// RS_U_Dval = analogRead(RS_U_D); // set val to read analog pin 4
RS_L_Rval = analogRead(RS_L_R);// set val to read analog pin 5
//*****************************End Read Sticks*******************
//**************convert pot to PWM values**************
LS_U_Dval = map(LS_U_Dval, 0, 1023, 0, 254);
// LS_L_Rval = map(LS_L_Rval, 0, 1023, 0, 254);
// RS_U_Dval = map(RS_U_Dval, 0, 1023, 0, 254);
RS_L_Rval = map(RS_L_Rval, 0, 1023, 0, 254);
Serial.println(LS_U_Dval);
//**************convert pot to PWM values**************
//**************put values in array?**************
byte vals[2];
//**********Send only 2 pots from sticks for now**********
vals[0] =LS_U_Dval;
vals[1] =RS_L_Rval;
//**********Send only 2 pots from sticks for now**********
// vals[0] =LS_L_Rval;
// vals[1] =LS_U_Dval;
// vals[2] =RS_L_Rval;
// vals[3] =RS_U_Dval;
//**************finish puting values in array?**************
//**************Start Transmit package**************
Mirf.setTADDR((byte *)"reci1"); // set name of Reciever
Mirf.send(vals); // data to send
//**************Start For loop to print array to local serial**************
/*
int i;
for (i = 0; i < 4; i = i + 1)
{
Serial.println(vals[i], DEC);
}
// */
//**************End For loop to print array to local serial**************
while(Mirf.isSending()){
}
delay(10);
}