Skip to content

Instantly share code, notes, and snippets.

@ypelletier
Created October 10, 2020 15:47
Show Gist options
  • Save ypelletier/7de89326a1aefc6344b4028ccfe31d64 to your computer and use it in GitHub Desktop.
Save ypelletier/7de89326a1aefc6344b4028ccfe31d64 to your computer and use it in GitHub Desktop.
Affichage de la masse en grammes avec un module HX711 branché à l'Arduino.
/********************************************************
Affichage de la masse en grammes avec un module HX711
branché à l'Arduino.
Nécessite le bibliothèque HX711 par Bodge:
https://github.com/bogde/HX711
Pour plus d'infos:
https://electroniqueamateur.blogspot.com/2020/10/balance-base-darduino.html
**********************************************************/
#include "HX711.h"
// HX711 circuit wiring
const int broche_DT = 2;
const int broche_SCK = 3;
HX711 balance;
void setup() {
Serial.begin(9600);
Serial.println("Initialisation de la balance...");
balance.begin(broche_DT, broche_SCK);
while (!balance.is_ready())
{
;
}
balance.set_scale(382); //calibration: le paramètre dépend de votre cellule de charge.
balance.tare(); //ajustement du zéro
Serial.println("La balance est prete!");
}
void loop() {
Serial.print(balance.get_units(10));
Serial.println(" grammes");
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment