ACM

Dependents:   loadcell

Committer:
j8813
Date:
Thu Feb 28 02:28:24 2019 +0000
Revision:
0:93a883c6277d
ACM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j8813 0:93a883c6277d 1 /*
j8813 0:93a883c6277d 2 * FILE: HX711.h
j8813 0:93a883c6277d 3 *
j8813 0:93a883c6277d 4 * VERSION: 0.1
j8813 0:93a883c6277d 5 * PURPOSE: HX711 weight library for Nucleo STM32
j8813 0:93a883c6277d 6 * AUTHOR: Bertrand Bouvier
j8813 0:93a883c6277d 7 * LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
j8813 0:93a883c6277d 8 *
j8813 0:93a883c6277d 9 * DATASHEET: http://www.dfrobot.com/image/data/SEN0160/hx711_english.pdf
j8813 0:93a883c6277d 10 * URL:
j8813 0:93a883c6277d 11 *
j8813 0:93a883c6277d 12 * HISTORY:
j8813 0:93a883c6277d 13 * 24/05/2015 - Bertrand Bouvier - Original version
j8813 0:93a883c6277d 14 * see HX711.cpp
j8813 0:93a883c6277d 15 *
j8813 0:93a883c6277d 16 * SPECIAL THANKS:
j8813 0:93a883c6277d 17 * Inspiré du travail de Weihong Guan (@aguegu)
j8813 0:93a883c6277d 18 * https://github.com/aguegu/Arduino
j8813 0:93a883c6277d 19 * http://aguegu.net
j8813 0:93a883c6277d 20 *
j8813 0:93a883c6277d 21 * Inspiré du travail de bodge
j8813 0:93a883c6277d 22 * https://github.com/bogde/HX711
j8813 0:93a883c6277d 23 *
j8813 0:93a883c6277d 24 */
j8813 0:93a883c6277d 25
j8813 0:93a883c6277d 26 #ifndef HX711_H
j8813 0:93a883c6277d 27 #define HX711_H
j8813 0:93a883c6277d 28
j8813 0:93a883c6277d 29 #include "mbed.h"
j8813 0:93a883c6277d 30
j8813 0:93a883c6277d 31
j8813 0:93a883c6277d 32 class HX711
j8813 0:93a883c6277d 33 {
j8813 0:93a883c6277d 34
j8813 0:93a883c6277d 35 public:
j8813 0:93a883c6277d 36 HX711(PinName pinData, PinName pinSck,uint8_t gain = 128);
j8813 0:93a883c6277d 37 ~HX711();
j8813 0:93a883c6277d 38 int getValue(void);
j8813 0:93a883c6277d 39 int averageValue(uint8_t times);
j8813 0:93a883c6277d 40 void setOffset(int offset);
j8813 0:93a883c6277d 41 void setScale(float scale);
j8813 0:93a883c6277d 42 float getGram();
j8813 0:93a883c6277d 43 void setGain(uint8_t gain);
j8813 0:93a883c6277d 44 void powerDown();
j8813 0:93a883c6277d 45 void powerUp();
j8813 0:93a883c6277d 46 void tare(uint8_t times = 10);
j8813 0:93a883c6277d 47
j8813 0:93a883c6277d 48
j8813 0:93a883c6277d 49 private:
j8813 0:93a883c6277d 50 PinName _pinData;
j8813 0:93a883c6277d 51 PinName _pinSck;
j8813 0:93a883c6277d 52 int _offset;
j8813 0:93a883c6277d 53 float _scale;
j8813 0:93a883c6277d 54 uint8_t _gain; //[128|32|64]
j8813 0:93a883c6277d 55
j8813 0:93a883c6277d 56
j8813 0:93a883c6277d 57 };
j8813 0:93a883c6277d 58
j8813 0:93a883c6277d 59 #endif
j8813 0:93a883c6277d 60
j8813 0:93a883c6277d 61