Skip to content
Permalink
Browse files

Simplify pinout definitions by not trying

to use constants for digital pins at all
  • Loading branch information...
amotl committed Feb 20, 2019
1 parent 7d75502 commit 83c9f5172694d1a0fb483bd407cf45eb8d163613
@@ -13,15 +13,9 @@ It supports the platforms `atmelavr`, `espressif8266`, `espressif32`,
#include "HX711.h"
HX711 loadcell;
// 1. Loadcell settings
// AVR and friends
const int LOADCELL_DOUT_PIN = A1;
const int LOADCELL_SCK_PIN = A0;
// ESP and friends
const int LOADCELL_DOUT_PIN = D2;
const int LOADCELL_SCK_PIN = D3;
// 1. HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;
// 2. Adjustment settings
const long LOADCELL_OFFSET = 50682624;
@@ -1,27 +1,24 @@
#include "HX711.h"

// CIRCUIT:
// HX711 DOUT TO PIN 2
// HX711 PD_SCK TO PIN 3
//
// Pin definitions D2 and D3 are provided by "nodemcu" board,
// see `nodemcu/pins_arduino.h`.
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;

HX711 scale;

void setup() {
Serial.begin(57600);
scale.begin(D2, D3);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
}

void loop() {

if ( scale.is_ready() ) {
if (scale.is_ready()) {
long reading = scale.read();
Serial.print("HX711 reading: ");
Serial.println(reading);
} else {
Serial.println("HX711 was not found or not ready.");
Serial.println("HX711 not found.");
}

delay(1000);
@@ -7,22 +7,13 @@
* (c) 2018 Bogdan Necula
*
**/
#include "HX711.h"

/**
*
* Pin definition examples
*
* AVR and friends
* HX711.DOUT - pin #A1
* HX711.PD_SCK - pin #A0
*
* ESP and friends
* HX711.DOUT - pin #D2
* HX711.PD_SCK - pin #D3
*
**/

#include "HX711.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;


HX711 scale;

@@ -38,7 +29,7 @@ void setup() {
// - With a gain factor of 32, channel B is selected
// By omitting the gain factor parameter, the library
// default "128" (Channel A) is used here.
scale.begin(A1, A0);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

Serial.println("Before setting up the scale:");
Serial.print("read: \t\t");
@@ -1,14 +1,14 @@
#include "HX711.h"

// CIRCUIT:
// HX711 DOUT TO PIN 2
// HX711 PD_SCK TO PIN 3
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;

HX711 scale;

void setup() {
Serial.begin(57600);
scale.begin(D2, D3);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
}

void loop() {
@@ -1,14 +1,14 @@
#include "HX711.h"

// CIRCUIT:
// HX711 DOUT TO PIN 2
// HX711 PD_SCK TO PIN 3
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;

HX711 scale;

void setup() {
Serial.begin(57600);
scale.begin(D2, D3);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
}

void loop() {
@@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/bogde/HX711.git"
},
"version": "0.6.0",
"version": "0.7.1",
"exclude": "tests",
"examples": "examples/*/*.ino",
"frameworks": "arduino",
@@ -14,9 +14,7 @@ include_dir = .

[config]
build_flags =
-D D2=2
-D D3=3
-D VERSION=1.2.3
-D VERSION=0.7.1
-D DEBUG=1

src_filter =

0 comments on commit 83c9f51

Please sign in to comment.
You can’t perform that action at this time.