HX711 on stm32f103c8t6

Dependents:   HX711b_not_tar_test

Fork of HX711 by Cr300-Litho

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HX711.h Source File

HX711.h

00001 /*
00002  * FILE: HX711.h
00003  * 
00004  * VERSION: 0.1
00005  * PURPOSE: HX711 weight library for Nucleo STM32
00006  * AUTHOR: Bertrand Bouvier
00007  * LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
00008  *
00009  * DATASHEET: http://www.dfrobot.com/image/data/SEN0160/hx711_english.pdf
00010  * URL: 
00011  *
00012  * HISTORY:
00013  * 24/05/2015 - Bertrand Bouvier - Original version
00014  * see HX711.cpp
00015  *
00016  * SPECIAL THANKS:
00017  *  Inspiré du travail de Weihong Guan (@aguegu)
00018  *  https://github.com/aguegu/Arduino
00019  *  http://aguegu.net
00020  *  
00021  *  Inspiré du travail de bodge
00022  *  https://github.com/bogde/HX711
00023  *
00024  */
00025  
00026 #ifndef HX711_H
00027 #define HX711_H
00028 
00029 #include "mbed.h"
00030 
00031 
00032 class HX711
00033 {
00034 
00035 public:
00036     HX711(PinName pinData, PinName pinSck,uint8_t gain = 128);
00037     ~HX711();
00038     int getValue(void);
00039     int averageValue(uint8_t times);
00040     void setOffset(int offset);
00041     void setScale(float scale);
00042     float getGram();
00043     void setGain(uint8_t gain);
00044     void powerDown();
00045     void powerUp();
00046     void tare(uint8_t times = 10);
00047 
00048 
00049 private:
00050     PinName _pinData;
00051     PinName _pinSck;
00052     int _offset;
00053     float _scale;
00054     uint8_t _gain; //[128|32|64]
00055     
00056 
00057 };
00058 
00059 #endif