Arduino Polska Forum

Pełna wersja: HX711 + LCD 2x16 biblioteka
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
Witam,

Mam w zasadzie dwa problemy.

Jest to mój początek z Arduino i pierwszy projekt.

Udało mi się uruchomić LCD'ka i wpisywać odpowiednie komentarze z wykorzystaniem biblioteki HelloWorld!
Znalazłem bibliotekę dla HX711 (wzmacniacz) belki tensometrycznej.

1. Nie mogę znaleźć albo źle szukam podłączenia HX711 do płytki stykowej i arduino
2. Jak połączyć 2 biblioteki aby odczyt z tensometru był emitowany na LCD?
https://www.google.pl/search?q=HX711+ard...35&bih=673

https://learn.sparkfun.com/tutorials/loa...okup-guide

za ostatnim kodem dodano lcd 16x2

Kod:
/*
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"

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch

#define DOUT  3
#define CLK  2

HX711 scale(DOUT, CLK);

void setup() {

  lcd.begin(16, 2);
  
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  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() {

lcd.setCursor(0, 1);
lcd.print((scale.get_units(), 1));
  
  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();
}