I am trying to send wirelessly data to another Arduino, but I cannot do that because it is float data type.
Now, I have investigated that I can float multiply and get full number and then convert to string. But I do not know how to multiply!
Serial.println(scale.get_units(), 3);
It prints number xx.xxx and I want it multiply by 10 000.
Can you help me please
Thanks for replay, but it does not work for me. Number "3" means how much numbers will be after comma. I did how you showed me, but output was different result. I don not know how to convert this FLOAT function in integer. I need send result through Wireless 2.4GHZ.
#include "HX711.h";
//******************Wireless********************
#include <SPI.h>
#include <RH_NRF24.h>
//******************Wireless********************
#define calibration_factor 38900 //This value is obtained using the SparkFun_HX711_Calibration sketch
//******************Wireless********************
RH_NRF24 nrf24;
//******************Wireless********************
HX711 scale(A1, A0);
void setup() {
Serial.begin(9600);
scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
//******************Wireless********************
if (!nrf24.init())
Serial.println("init failed");
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(1))
Serial.println("setChannel failed");
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm))
Serial.println("setRF failed");
//******************Wireless********************
}
void loop() {
Serial.println(scale.get_units(), 3); //scales value
//******************Wireless********************
// Send a message to nrf24_server
char* msg = "I need get there scale function (scale.get_units(), 3)";
if (!nrf24.send((uint8_t*)msg, strlen(msg)))
Serial.println("send failed");
nrf24.waitPacketSent();
//******************Wireless********************
}
I have tried different ways, but always something goes wrong