So why did you jump forum?
Texas Instrument CC1350 UART for RSSI si - C++ Forum
Let's say your RSSI is an int, since you format it as one.
So you want an average of three.
Code:
int rawRSSI[3];
int numSamples = 0;
So your first step is
Code:
rawRSSI[numSamples++] = receivedRSSI; // you didn't show how this arrives.
You then say
Code:
if ( numSamples == 3 ) {
int avgRSSI = ( rawRSSI[0] + rawRSSI[1] + rawRSSI[2] ) / 3;
char buff[20]; // take a chance that 10 is always enough
sprintf(buff,"%s %d",rxPacket,avgRSSI);
UART_write(uart, buff, strlen(buff));
}
What do you want to happen next?
- Throw away all the samples, get three more and then output another average.
- Throw away the oldest sample, get one more sample, and output a moving average.