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