AnalogRead() causes CC1101 RF module receiver to hang up.

Hi all,
I'm using a NEXT CC1101RF module to send sensor values from AnalogRead(A0). This causes the receiver to receiver a packet the is empty, then not receiver any more packets. If I comment out the AnalogRead(), every thing works normal.
It's using the SPI interface on an UNO.
I have it connected according to: Arduino : use a Texas CC1101 – Erwan's Blog Those example do work ok.

I've looked thru the CC1101.cpp & h files, but don't see anything that would affect the analogRead().

The NEXT receiver is this:
http://www.amazon.com/gp/product/B00NPZ3YUA/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

CC1101 uses the spi library, but that shouldn't screw up AnalogRead().

I just thought, maybe I need to add PinMode(A0,INPUT), though by default they're inputs, yes?

Any Ideas to get AnalogRead() to transmitt it's value?

Any Ideas to get AnalogRead() to transmitt it's value?

Fix your code. If you don't know how, perhaps you might give some fleeting thought to posting it.

I would fix it if I new where. I've been working this problem for about three days, so I turned here.
Transmitter code:

CODE TAGS PLEASE!

 #include "EEPROM.h"
#include "cc1101.h"

CC1101 cc1101;

// The LED is wired to the Arduino Output 4 (physical panStamp pin 19)
#define LEDOUTPUT 4

// counter to get increment in each loop
byte counter;
byte b;
byte syncWord = 199;
int sensorPin = A0;    // select the input pin for the potentiometer
byte sensorValue;
int x;

void blinker()
{
 digitalWrite(LEDOUTPUT, HIGH);
 delay(100);
 digitalWrite(LEDOUTPUT, LOW);
 delay(100);
}

void setup()
{
 Serial.begin(9600);
 Serial.println("start");

 // setup the blinker output
 pinMode(LEDOUTPUT, OUTPUT);
 digitalWrite(LEDOUTPUT, LOW);
 
 // blink once to signal the setup
 blinker();
 
 // reset the counter
 counter=0;
 Serial.println("initializing...");
 // initialize the RF Chip
 cc1101.init();
 
 cc1101.setSyncWord(&syncWord, false);
 cc1101.setCarrierFreq(CFREQ_915);
 cc1101.disableAddressCheck();
 //cc1101.setTxPowerAmp(PA_LowPower);
 
 delay(1000);
 
 Serial.print("CC1101_PARTNUM "); //cc1101=0
 Serial.println(cc1101.readReg(CC1101_PARTNUM, CC1101_STATUS_REGISTER));
 Serial.print("CC1101_VERSION "); //cc1101=4
 Serial.println(cc1101.readReg(CC1101_VERSION, CC1101_STATUS_REGISTER));
 Serial.print("CC1101_MARCSTATE ");
 Serial.println(cc1101.readReg(CC1101_MARCSTATE, CC1101_STATUS_REGISTER) & 0x1f);
 
 Serial.println("device initialized");
 //Serial.println("done");
}

void send_data() 
{
 CCPACKET data;
 
 data.length=3;
 
 byte blinkCount=counter++;
 
 data.data[0]=5;
 data.data[1]=sensorValue;
//  data.data[1]=blinkCount;
 data.data[2]=2;
 Serial.print("data.data[1] :");
 Serial.println(data.data[1]);
 
 //cc1101.flushTxFifo ();

 Serial.print("CC1101_MARCSTATE ");
 Serial.println(cc1101.readReg(CC1101_MARCSTATE, CC1101_STATUS_REGISTER) & 0x1f);

 if(cc1101.sendData(data))
 {
   Serial.print(blinkCount,HEX);
   Serial.println(" sent ok :)");
   blinker();
 }
 else
 {
   Serial.println("sent failed :(");
   blinker();
   blinker();
 }
}


void loop()
{
 sensorValue =analogRead(A0)/1000;
 send_data();
 delay(2000);
}

Receiver code:

#include "EEPROM.h"
#include "cc1101.h"

// The LED is wired to the Arduino Output 4 (physical panStamp pin 19)
#define LEDOUTPUT 4

#define DESTINATION_ADDR 5       // Receiver address

// The connection to the hardware chip CC1101 the RF Chip
CC1101 cc1101;

byte b;
byte i;
byte syncWord = 199;
long counter=0;
byte chan=0;

// a flag that a wireless packet has been received
boolean packetAvailable = false;

void blinker()
{
 digitalWrite(LEDOUTPUT, HIGH);
 delay(1000);
 digitalWrite(LEDOUTPUT, LOW);
 delay(100);
}

/* Handle interrupt from CC1101 (INT0) gdo0 on pin2 */
void cc1101signalsInterrupt(void)
{
 // set the flag that a package is available
 packetAvailable = true;
}

void setup()
{
 Serial.begin(9600);
 Serial.println("start");

 // setup the blinker output
 pinMode(LEDOUTPUT, OUTPUT);
 digitalWrite(LEDOUTPUT, LOW);
 // blink once to signal the setup
//  blinker();
 
 // initialize the RF Chip
 cc1101.init();

 cc1101.setSyncWord(&syncWord, false);
 cc1101.setCarrierFreq(CFREQ_915);
 
 cc1101.disableAddressCheck(); //if not specified, will only display "packet received"
 //cc1101.setTxPowerAmp(PA_LowPower);
 
 Serial.print("CC1101_PARTNUM "); //cc1101=0
 Serial.println(cc1101.readReg(CC1101_PARTNUM, CC1101_STATUS_REGISTER));
 Serial.print("CC1101_VERSION "); //cc1101=4
 Serial.println(cc1101.readReg(CC1101_VERSION, CC1101_STATUS_REGISTER));
 Serial.print("CC1101_MARCSTATE ");
 Serial.println(cc1101.readReg(CC1101_MARCSTATE, CC1101_STATUS_REGISTER) & 0x1f);

 attachInterrupt(0, cc1101signalsInterrupt, FALLING);

 Serial.println("device initialized");
}

void ReadLQI()
{
 byte lqi=0;
 byte value=0;
 lqi=(cc1101.readReg(CC1101_LQI, CC1101_STATUS_REGISTER));
 value = 0x3F - (lqi & 0x3F);
 Serial.print("CC1101_LQI ");
 Serial.println(value);
}

void ReadRSSI()
{
 byte rssi=0;
 byte value=0;

 rssi=(cc1101.readReg(CC1101_RSSI, CC1101_STATUS_REGISTER));

 if (rssi >= 128)
 {
   value = 255 - rssi;
   value /= 2;
   value += 74;
 }
 else
 {
   value = rssi/2;
   value += 74;
 }
 Serial.print("CC1101_RSSI ");
 Serial.println(value);
}

void loop()
{
 if(packetAvailable)
 {
   digitalWrite(LEDOUTPUT, HIGH);

   Serial.println("packet received");
   // Disable wireless reception interrupt
   detachInterrupt(0);
   
   ReadRSSI();
   ReadLQI();
   // clear the flag
   packetAvailable = false;
   
   CCPACKET packet;
  
     if(cc1101.receiveData(&packet) > 0)
     {
       if(!packet.crc_ok) 
       {
         Serial.println("crc not ok");
       }
     
       if(packet.length > 0)
       {
         Serial.print("packet: len ");
         Serial.print(packet.length);
         Serial.print(" data: ");
         for(int j=0; j<packet.length; j++){
           Serial.print(packet.data[j],DEC);
           Serial.print(" ");
         }
         Serial.println(".");
       }
     }
   // Enable wireless reception interrupt
   attachInterrupt(0, cc1101signalsInterrupt, FALLING);
   digitalWrite(LEDOUTPUT, LOW);
 }
}
 sensorValue =analogRead(A0)/1000;

What values will be stored in sensorValue? Does sending 0 or 1 really make sense?

Does it matter if you use a different analog pin?

Does it matter if you post a link to the hardware and libraries you are using? (Hint: Absolutely)

Hi, it doesn't really matter, 0 or 1 or any number, the problem is AnalogRead() hangs up.

Any Analog pin causes the same problem.

I did post a link to the hardware:

The NEXT receiver is this:
http://www.amazon.com/gp/product/B00NPZ3YUA/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

And the libraries are #include "EEPROM.h" and #include "cc1101.h".

(CC1101 is from the PanStamp library: GitHub - panStamp/panstamp: panStamp wireless ecosystem - Project files)

Thanks for helping