mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.5.0 HX711
This commit is contained in:
parent
12257c41f9
commit
51f2cb1558
@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.0] - 2024-06-17
|
||||||
|
- fix #50, bug in constructor (thanks Mathieu!)
|
||||||
|
- refactor constructor
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## [0.4.0] - 2024-03-02
|
## [0.4.0] - 2024-03-02
|
||||||
- add fastProcessor option in **begin()** (Thanks to palmerr23)
|
- add fastProcessor option in **begin()** (Thanks to palmerr23)
|
||||||
- updated license
|
- updated license
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: HX711.cpp
|
// FILE: HX711.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.4.0
|
// VERSION: 0.5.0
|
||||||
// PURPOSE: Library for load cells for UNO
|
// PURPOSE: Library for load cells for UNO
|
||||||
// URL: https://github.com/RobTillaart/HX711_MP
|
// URL: https://github.com/RobTillaart/HX711_MP
|
||||||
// URL: https://github.com/RobTillaart/HX711
|
// URL: https://github.com/RobTillaart/HX711
|
||||||
@ -12,7 +12,13 @@
|
|||||||
|
|
||||||
HX711::HX711()
|
HX711::HX711()
|
||||||
{
|
{
|
||||||
reset();
|
_gain = HX711_CHANNEL_A_GAIN_128;
|
||||||
|
_offset = 0;
|
||||||
|
_scale = 1;
|
||||||
|
_lastRead = 0;
|
||||||
|
_price = 0;
|
||||||
|
_mode = HX711_AVERAGE_MODE;
|
||||||
|
_fastProcessor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -39,10 +45,11 @@ void HX711::reset()
|
|||||||
{
|
{
|
||||||
power_down();
|
power_down();
|
||||||
power_up();
|
power_up();
|
||||||
|
_gain = HX711_CHANNEL_A_GAIN_128;
|
||||||
_offset = 0;
|
_offset = 0;
|
||||||
_scale = 1;
|
_scale = 1;
|
||||||
_gain = HX711_CHANNEL_A_GAIN_128;
|
|
||||||
_lastRead = 0;
|
_lastRead = 0;
|
||||||
|
_price = 0;
|
||||||
_mode = HX711_AVERAGE_MODE;
|
_mode = HX711_AVERAGE_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,19 +2,20 @@
|
|||||||
//
|
//
|
||||||
// FILE: HX711.h
|
// FILE: HX711.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.4.0
|
// VERSION: 0.5.0
|
||||||
// PURPOSE: Library for load cells for Arduino
|
// PURPOSE: Library for load cells for Arduino
|
||||||
// URL: https://github.com/RobTillaart/HX711_MP
|
// URL: https://github.com/RobTillaart/HX711_MP
|
||||||
// URL: https://github.com/RobTillaart/HX711
|
// URL: https://github.com/RobTillaart/HX711
|
||||||
//
|
//
|
||||||
// NOTES
|
// NOTES
|
||||||
// Superset of interface of HX711 class of Bogde
|
// Superset of interface of HX711 class of Bogde
|
||||||
// float instead of long as float has 23 bits mantissa.
|
// uses float instead of long as float has 23 bits mantissa
|
||||||
|
// which almost perfectly matches the 24 bit ADC.
|
||||||
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
#define HX711_LIB_VERSION (F("0.4.0"))
|
#define HX711_LIB_VERSION (F("0.5.0"))
|
||||||
|
|
||||||
|
|
||||||
const uint8_t HX711_AVERAGE_MODE = 0x00;
|
const uint8_t HX711_AVERAGE_MODE = 0x00;
|
||||||
@ -175,16 +176,16 @@ private:
|
|||||||
uint8_t _dataPin;
|
uint8_t _dataPin;
|
||||||
uint8_t _clockPin;
|
uint8_t _clockPin;
|
||||||
|
|
||||||
uint8_t _gain = 128; // default channel A
|
uint8_t _gain;
|
||||||
long _offset = 0;
|
long _offset;
|
||||||
float _scale = 1;
|
float _scale;
|
||||||
uint32_t _lastRead = 0;
|
uint32_t _lastRead;
|
||||||
float _price = 0;
|
float _price;
|
||||||
uint8_t _mode = HX711_AVERAGE_MODE;
|
uint8_t _mode;
|
||||||
|
bool _fastProcessor;
|
||||||
|
|
||||||
void _insertSort(float * array, uint8_t size);
|
void _insertSort(float * array, uint8_t size);
|
||||||
uint8_t _shiftIn();
|
uint8_t _shiftIn();
|
||||||
bool _fastProcessor = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ See https://github.com/RobTillaart/HX711/issues/40
|
|||||||
- example the adding scale
|
- example the adding scale
|
||||||
- void weight_clr(), void weight_add(), float weight_get() - adding scale
|
- void weight_clr(), void weight_add(), float weight_get() - adding scale
|
||||||
- decide pricing keep/not => move to .cpp
|
- decide pricing keep/not => move to .cpp
|
||||||
- add **setRate()** and **getRate()**
|
- add **setRate()** and **getRate()** - sample rate 10/80 SPS
|
||||||
- optional?
|
- optional?
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/HX711"
|
"url": "https://github.com/RobTillaart/HX711"
|
||||||
},
|
},
|
||||||
"version": "0.4.0",
|
"version": "0.5.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "*",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=HX711
|
name=HX711
|
||||||
version=0.4.0
|
version=0.5.0
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for HX711 load cell amplifier
|
sentence=Arduino library for HX711 load cell amplifier
|
||||||
|
Loading…
Reference in New Issue
Block a user