I'd like to run 2 of them on one microcontroller but I can't if I'm using library,so I would like to run them without library.Can anyone help me?
I can't if I'm using library
Why do you think that? Which library are you using? A couple of the libraries I glanced at looked like they would work fine with multiple "instances" of the chip - that's one of the advantages of object-oriented programming, at least until you start running into conflicts for hardware resources. (And the HX711 has a funky serial interface that typically won't use actual hardware peripherals beyond GPIO.)
For example, using Library: HX711, I think you should be able to do:
HX711 scale1(A1, A0);
HX711 scale2(A2, A3);
:
weight1 = scale1.read();
weight2 = scale2.read();
Thanks man,I didn't know that I can run multiple HX711 on one library
when i use hx711 library and ros library together i get this msg."Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino"
this is my code on arduino
#include <ros.h>
#include <std_msgs/Float64.h>
#include "HX711.h"
#define DOUT 3//
#define CLK 2//
HX711 scale;
float calibration_factor = -5880; //-7050 worked for my 440lb max scale setup
ros::NodeHandle nh;
std_msgs::Float64 test;
ros::Publisher p2("my_topic", &test);
void setup()
{
delay(2000);
scale.begin(DOUT, CLK);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
delay(2000);
nh.initNode();
nh.advertise(p2);
delay(2000);
}
void loop()
{
delay(200);
scale.set_scale(calibration_factor); //Adjust to this calibration factor
float weight=(scale.get_units());
test.data = weight;
p2.publish( &test );
nh.spinOnce();
}
ros command is this
rosrun rosserial_python serial_node.py /dev/ttyUSB1
is there any way to use hx711 withouth library. because i am sure this asencronization happening because library when i cancel library to send number it s work fine but when i activated the library i get this msg.