ACM experimental

Dependents:   loadcell_2

Committer:
j8813
Date:
Thu Feb 28 02:43:30 2019 +0000
Revision:
0:fa474b1aef70
ACM experimental

Who changed what in which revision?

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