Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/IvDm/Z-probe-on-smd-resistors-2512.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvDm <43366555+IvDm@users.noreply.github.com>2020-01-07 21:59:28 +0300
committerGitHub <noreply@github.com>2020-01-07 21:59:28 +0300
commit856726a91c327cd30f018000897f46c5c5640ab0 (patch)
tree28bc61f0dbb5f0c7f3f3c6aef6b0c8d245c7d2ed
parenta73bb2a3cfa8ae17cc5d3086434e38e18beecc09 (diff)
Update strain_gage_switch_ATtiny85.ino
-rw-r--r--strain_gage_switch_ATtiny85.ino70
1 files changed, 36 insertions, 34 deletions
diff --git a/strain_gage_switch_ATtiny85.ino b/strain_gage_switch_ATtiny85.ino
index 35673cc..75a6442 100644
--- a/strain_gage_switch_ATtiny85.ino
+++ b/strain_gage_switch_ATtiny85.ino
@@ -1,35 +1,37 @@
-// CPU ATtiny 85 , clock internal 8MHz
-// HX711 library: https://github.com/bogde/HX711
-// HX711.DOUT - вывод # A3
-// HX711.PD_SCK - вывод # A2
-
-#include <HX711.h>
-#define ledPin 0 //Pin indicator LED
-#define switchPin 2 //Switch pin
-HX711 scale(A3,A2);
-
-void setup() {
- pinMode(ledPin, OUTPUT);
- scale.set_scale(15000.f);//This parameter is responsible for the sensor sensitivity. The best results for values ​​from 10000.f to 30000.f
- scale.tare(1);
-}
-
-void loop() {
- long value=0;
- value=scale.get_units(1);
- if(value<=-1 || value>=1)
- {
- digitalWrite(ledPin, HIGH);
- pinMode(switchPin, OUTPUT);
- digitalWrite(switchPin, LOW);//Pull the switch pin to ground
- delay(50);
- scale.tare(1);
- }
- else
- {
- digitalWrite(ledPin, LOW);
- pinMode(switchPin, INPUT);//switch pin - high impedance
- }
-}
-
+// CPU ATtiny 85 , clock internal 8MHz
+// HX711 library: https://github.com/bogde/HX711
+// HX711.DOUT - вывод # A3
+// HX711.PD_SCK - вывод # A2
+
+#include <HX711.h>
+#define ledPin 0 //Pin indicator LED
+#define switchPin 2 //Switch pin
+const int LOADCELL_DOUT_PIN = A3;
+const int LOADCELL_SCK_PIN = A2;
+HX711 scale;
+
+void setup() {
+ pinMode(ledPin, OUTPUT);
+ scale.set_scale(15000.f);//This parameter is responsible for the sensor sensitivity. The best results for values ​​from 10000.f to 30000.f
+ scale.tare(1);
+}
+
+void loop() {
+ long value=0;
+ value=scale.get_units(1);
+ if(value<=-1 || value>=1)
+ {
+ digitalWrite(ledPin, HIGH);
+ pinMode(switchPin, OUTPUT);
+ digitalWrite(switchPin, LOW);//Pull the switch pin to ground
+ delay(50);
+ scale.tare(1);
+ }
+ else
+ {
+ digitalWrite(ledPin, LOW);
+ pinMode(switchPin, INPUT);//switch pin - high impedance
+ }
+}
+