Hi everyone
I'm very new to the world of Arduino's and coding, so this will most likely be an easy to fix issue.
I'm trying to output a reading from a HX711 module (which is a load cell amplifier) through RF 433mhz modules. However the output from the HX711 is in float form as it has a decimal place. The modules seem to only support const char transmission. In the research I have done it seems that the most common solution is to use a dtostrf function. However I can't see anywhere how exactly this is implemented. And further more it seems to primarily be used single values where as mine is variable. Any help as to how to combine the 2 codes below would be great.
First code is HX711 output
*/
#include "HX711.h"
#define calibration_factor +14720
#define DOUT 3
#define CLK 2
HX711 scale;
void setup() {
Serial.begin(9600);
Serial.println("HX711 scale demo");
scale.begin(DOUT, CLK);
scale.set_scale(calibration_factor);
scale.tare();
Serial.println("Readings:");
}
void loop() {
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" kg");
Serial.println();
}
Second code is RF output
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver;
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
const char *msg = "Hello World!";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(1000);
}