Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 1 month ago.
convert arduino code to mbed
hi could someone help convert this code to mbed
- include "HX711.h"
- define calibration_factor -7050.0 This value is obtained using the SparkFun_HX711_Calibration sketch
- define DOUT 3
- define CLK 2
HX711 scale(DOUT, CLK);
void setup() { Serial.begin(9600); Serial.println("HX711 scale demo");
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
Serial.println("Readings:"); }
void loop() { Serial.print("Reading: "); Serial.print(scale.get_units(), 1); scale.get_units() returns a float Serial.print(" lbs"); You can change this to kg but you'll need to refactor the calibration_factor Serial.println(); }