2015-03-21 15:52:03 -03:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Author: Rafael da Mata Neri <rafael.neri@gmail.com>
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
|
|
|
*
|
2017-08-30 15:00:29 -07:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of
|
2015-03-21 15:52:03 -03:00
|
|
|
* this software and associated documentation files (the "Software"), to deal in
|
|
|
|
* the Software without restriction, including without limitation the rights to
|
2017-08-30 15:00:29 -07:00
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
|
* of
|
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do
|
|
|
|
* so,
|
2015-03-21 15:52:03 -03:00
|
|
|
* subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
2017-08-30 15:00:29 -07:00
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS
|
2015-03-21 15:52:03 -03:00
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
//! [Interesting]
|
2016-04-25 14:27:51 -07:00
|
|
|
#include "hx711.hpp"
|
2015-03-21 15:52:03 -03:00
|
|
|
|
|
|
|
int
|
2017-08-30 15:00:29 -07:00
|
|
|
main(int argc, char** argv)
|
2015-03-21 15:52:03 -03:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::HX711 scale(3, 2);
|
2015-03-21 15:52:03 -03:00
|
|
|
|
|
|
|
// 2837: value obtained via calibration
|
2017-08-30 15:00:29 -07:00
|
|
|
scale.setScale(2837);
|
|
|
|
scale.tare();
|
|
|
|
std::cout << scale.getUnits() << std::endl;
|
2015-03-21 15:52:03 -03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
//! [Interesting]
|