RadioHead RH_ASK driver.waitpacketsent(); arduino uno hang

Hi ,

Need your help.

Trying add a 433Mhz transmitter/reciever to an existing sketch.

I have no problem running the example sketch for the RH_ASK - works fine.

But when I tried to add code into my existing sketch the Arduio UNO freeze at transmitting e.g driver.waitpacketsent();

From a lot of googling I suspect i have something todo with the TIMER1 or TIMER2. Tried to change the library to have RH_ASK to use TIMER2 as i is prepared for it. Also tried to change to TIMER5 but that did not pass complilation. Here I´m lost as I pretty new on this. It seemed as the code change did not like UNO - HW dependent ?

Anyway anyone who have encountered and solved Timer issues i RH_ASK(outside the the TIMER2 option) ?

I have started to disable code to isolate the probelm.

Have Disable LCD , Temp sensors but still have a weight sensor HX711 active.

So I suspect this is issue - so any one tried to use RH with HX711 ?

I don´t have the code here to uppload will do later

Any clue out there ??

BR/J-O

I don´t have the code here to uppload will do later

But you decided to waste our time by posting the question that we can't possibly answer until you post your code. Why?

PaulS - possible some one have encountered the exact same problem and have a solution at hand.
Then I don´t waste your time reading code - thats why.

Hi ,

Now I have more supporting info :

I think I have pinpointed it to conflict between RH_ASK and HX711 but don´t have a clue what the problem is and how or if it can be solved.

I have exampel code working for both RH_ASK and for the HX711. Trying to combine fails for me.Ange koden här...

I have inserted 5 println as break 1 - 5. Excuting the code and it stops at break 4 - just before driver.waitPacketSent();

#include "HX711.h"

#include 
#include  // Not actually used but needed to compile
HX711 scale;
RH_ASK driver(2000, 4, 12, 5); 
void setup() {
Serial.begin(38400);
Serial.println("HX711 Demo");

Serial.println("Initializing the scale");
// parameter "gain" is ommited; the default value 128 is used by the library
// HX711.DOUT  - pin #A1
// HX711.PD_SCK - pin #A0
scale.begin(A1, A0);

Serial.print("Raw ave(20): \t\t");
Serial.println(scale.read_average(20));   // print the average of 20 readings from the ADC

// Scale factor:
// 1Kg cell: 2020 for reading in gms
// 50kg cells: 19150 for reading in kg 22446 -lower value  = higher weight
scale.set_scale(22999.f);                      // this value is obtained by calibrating the scale with known weights; see the README for details
//scale.tare();               // reset the scale to 0 - do not

Serial.println("\nAfter setting up the scale:");

Serial.print("Raw: \t\t\t");
Serial.println(scale.read());                 // print a raw reading from the ADC

Serial.print("Raw ave(20): \t\t");
Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC

Serial.print("Raw ave(5) - tare: \t");
Serial.println(scale.get_value(5));   // print the average of 5 readings from the ADC minus the tare weight, set with tare()

Serial.print("Calibrated ave(5): \t");
Serial.println(scale.get_units(5), 1);        // print the average of 5 readings from the ADC minus tare weight, divided
          // by the SCALE parameter set with set_scale

Serial.println("\nReadings:");
}

void loop() {
int t, i, n, T;
double val, sum, sumsq, mean;
float stddev;

  Serial.println("break 1");
n = 20;
t = millis();
i = sum = sumsq = 0;
while (i

In the terminal you can see that break 4 is the last thing before freeze.

HX711 Demo Initializing the scale Raw ave(20): 0

After setting up the scale: Raw: 0 Raw ave(20): 0 Raw ave(5) - tare: 0.00 Calibrated ave(5): 0.0

Readings: break 1 break 2 Mean, Std Dev of 20 readings: 0.000 0.000 Time taken: 0.008Secs

break 3 hello break 4

I would be grateful if some one could help me find a solution

Now I have more supporting info :

Good, but you (or we) need even more. First, we need a link to the RH_ASK library, so that we can see what the arguments to the constructor are. Second, we need a link to the HX711 library, so that we can see which pins it uses.

The RH_ASK library I found, which may or may not be the same one you are using, indicates that the 12 in your call to the constructor is the TX pin.

But, there is this line in your code:

#include <SPI.h> // Not actually used but needed to compile

Which tells me that some hardware you are using IS using SPI, which means that you can NOT use the SPI pins (10 to 13 on the UNO) for ANY other purpose.

Hi ,

I found the issue with help from the RadioHead google group...

Pretty silly fault by me ... did not copy the init.driver() from example due to it was in a if statement that I believed to just serial.print a message that init failed. But besides that it actually inititated the driver.

Serial.begin(9600);   // Debugging only
    if (!driver.init())
         Serial.println("init failed");

So, it was just shit behind the wheel here.

Sorry for taken up your time and thank you for showing interrest.

BR/J-O

etxjaol: Hi ,

I found the issue with help from the RadioHead google group... [...]

BR/J-O

Thank you!!