Created
October 10, 2020 15:47
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************** | |
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