ppm signal transmission using (nrf24l01 ) and( fs a8 )receiver

I am trying to send a ppm signal over two nrfs one nrf1 will receive the values from fsa8s and sends it to other nrf2 . I am trying to send 6 channels but only 3 channels are being sent and the other 3 are continuous zeros .can someone help me in this

--->NRF2
^
|
|

FS_A8s(rx) ----> arduino_nano ----->nrf1

====TX CODE====
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
unsigned long ch[6],t[7];
int pulse = 0;

RF24 radio(9, 10);

const byte rxAddr[6] = "00001";

void setup()
{
PCICR |=(1 << PCIE0);
PCMSK0 |=(1 << PCINT0);

radio.begin();
radio.openWritingPipe(rxAddr);
radio.stopListening();
Serial.begin(115200);
}

void loop()
{

radio.write(&ch[1],sizeof(ch[1]));
radio.write(&ch[2],sizeof(ch[2]));
radio.write(&ch[3],sizeof(ch[3]));
radio.write(&ch[4],sizeof(ch[4]));
radio.write(&ch[5],sizeof(ch[5]));
radio.write(&ch[0],sizeof(ch[0]));
Serial.print(ch[1]);
Serial.print(" - ");
Serial.print(ch[2]);
Serial.print(" - ");
Serial.print(ch[3]);
Serial.print(" - ");
Serial.print(ch[4]);
Serial.print(" - ");
Serial.print(ch[5]);
Serial.print(" - ");
Serial.println(ch[0]);
delay(100);
}
ISR(PCINT0_vect)
{
if(PINB & B00000001)
{
t[pulse] = micros();
switch(pulse)
{
case 1:
ch[1]=t[1]-t[0];
pulse++;
if(ch[1] > 3000)
{
t[0]=t[1];
pulse=1;
}
break;
case 2:
ch[2]=t[2]-t[1];
pulse++;
if(ch[2]>3000)
{
t[0]=t[2];
pulse=1;
}
break;
case 3:
ch[3]=t[3]-t[2];
pulse++;
if(ch[3] > 3000)
{
t[0]=t[3];
pulse=1;
}
break;
case 4:
ch[4]=t[4]-t[3];
pulse++;
if(ch[4] > 3000)
{
t[0]=t[4];
pulse=1;
}
break;
case 5:
ch[5]=t[5]-t[4];
pulse++;
if(ch[5] > 3000)
{
t[0]=t[5];
pulse=1;
}
break;
case 6:
ch[0]=t[6]-t[5];
pulse++;
if(ch[6] > 3000)
{
t[0]=t[6];
pulse=1;
}
break;
default:
pulse++;
break;

}
}
}

====RX_code====
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9,10);

const byte rxAddr[6] = "00001";
unsigned long ch[6];
void setup()
{
while (!Serial);
Serial.begin(115200);

radio.begin();
radio.openReadingPipe(0, rxAddr);

radio.startListening();
}

void loop()
{
if (radio.available())
{

radio.read(&ch[1],sizeof(ch[1]));
radio.read(&ch[2],sizeof(ch[2]));
radio.read(&ch[3],sizeof(ch[3]));
radio.read(&ch[4],sizeof(ch[4]));
radio.read(&ch[5],sizeof(ch[5]));
radio.read(&ch[0],sizeof(ch[0]));
Serial.print(ch[1]);
Serial.print(" - ");
Serial.print(ch[2]);
Serial.print(" - ");
Serial.print(ch[3]);
Serial.print(" - ");
Serial.print(ch[4]);
Serial.print(" - ");
Serial.print(ch[5]);
Serial.print(" - ");
Serial.println(ch[0]);
delay(1000);
}
}

thank you:-) :slight_smile: :slight_smile:

Please edit your post to add code tags, as described in the "How to use this forum" post.

Explain what you mean by a "ppm" signal.

If you're talking about a pulse position modulation, then you've got the wrong kind of radio. You need an RC transmitter.

If you mean something else then you need to make those variables that are referenced in both the ISR and the loop code volatile.

volatile unsigned long ch[6],t[7];

yes, I am using an RC radio flysky fs i6x

but the thing is I can read all ppm values and could transmit to other nrf but the nrf2 is only reading 3 channels but I want all the channels to be displayed