Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arduino
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
20-projet-ce-2020
Arduino
Commits
059db67f
Commit
059db67f
authored
4 years ago
by
Augustin Jaujay
Browse files
Options
Downloads
Patches
Plain Diff
Ajout mesure pc
parent
e0bb5e19
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Mesure_test_PC/Mesure_test_PC.ino
+50
-0
50 additions, 0 deletions
Mesure_test_PC/Mesure_test_PC.ino
with
50 additions
and
0 deletions
Mesure_test_PC/Mesure_test_PC.ino
0 → 100644
+
50
−
0
View file @
059db67f
/*
Example using the SparkFun HX711 breakout board with a scale
By: Nathan Seidle
SparkFun Electronics
Date: November 19th, 2014
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
This example demonstrates basic scale output. See the calibration sketch to get the calibration_factor for your
specific load cell setup.
This example code uses bogde's excellent library: https://github.com/bogde/HX711
bogde's library is released under a GNU GENERAL PUBLIC LICENSE
The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
based load cell which should allow a user to measure everything from a few grams to tens of tons.
Arduino pin 2 -> HX711 CLK
3 -> DAT
5V -> VCC
GND -> GND
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/
#include
"HX711.h"
#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define DOUT 3
#define CLK 2
HX711
scale
;
void
setup
()
{
Serial
.
begin
(
9600
);
Serial
.
println
(
"HX711 scale demo"
);
scale
.
begin
(
DOUT
,
CLK
);
scale
.
set_scale
(
calibration_factor
);
//This value is obtained by using the SparkFun_HX711_Calibration sketch
scale
.
tare
();
//Assuming there is no weight on the scale at start up, reset the scale to 0
Serial
.
println
(
"Readings:"
);
}
void
loop
()
{
Serial
.
print
(
"Reading: "
);
Serial
.
print
(
scale
.
get_units
(),
1
);
//scale.get_units() returns a float
Serial
.
print
(
" lbs"
);
//You can change this to kg but you'll need to refactor the calibration_factor
Serial
.
println
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment