9 years, 1 month ago.

convert arduino code to mbed

hi could someone help convert this code to mbed

  1. include "HX711.h"
  1. define calibration_factor -7050.0 This value is obtained using the SparkFun_HX711_Calibration sketch
  1. define DOUT 3
  2. 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(); }

Be the first to answer this question.