I am a first time user of arduino and i really need to finish this by the end of the day, but something is wrong with my code it keeps getting a "Compilation error: 'POSITIVE' was not declared in this scope", I'm trying to build a weighing scale.
#include <HX711_ADC.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
HX711_ADC LoadCell(4, 5); // parameters: dt pin, sck pin
LiquidCrystal_I2C Lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 0x27 is the i2c address of the LCM1602 IIC v1 module (might differ)
void setup() {
LoadCell.begin(); // start connection to HX711
LoadCell.start(2000); // load cells gets 2000ms of time to stabilize
LoadCell.setCalFactor(1.0); // TODO => calibration factor for load cell => strongly dependent on your individual setup
Lcd.begin(16, 2); // begins connection to the LCD module
Lcd.backlight(); // turns on the backlight
}
void loop() {
LoadCell.update(); // retrieves data from the load cell
float i = LoadCell.getData(); // get output value
Lcd.setCursor(0, 0); // set cursor to first row
Lcd.print("Weight [g]:"); // print out to LCD
Lcd.setCursor(0, 1); // set cursor to second row
Lcd.print(i); // print out the retrieved value to the second row
}
// (c) Michael Schoeffler 2017, http://www.mschoeffler.de
#include <HX711_ADC.h> // GitHub - olkal/HX711_ADC: Arduino library for the HX711 24-bit ADC for weight scales
#include <Wire.h>
#include <LiquidCrystal_I2C.h> // LiquidCrystal_I2C library
HX711_ADC LoadCell(4, 5); // parameters: dt pin, sck pin
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 characters and 2 line display
void setup() {
LoadCell.begin(); // start connection to HX711
LoadCell.start(2000); // load cells gets 2000ms of time to stabilize
LoadCell.setCalFactor(1.0); // TODO => calibration factor for load cell => strongly dependent on your individual setup
lcd.begin(16, 2); // begins connection to the LCD module
lcd.backlight(); // turns on the backlight
}
void loop() {
LoadCell.update(); // retrieves data from the load cell
float i = LoadCell.getData(); // get output value
lcd.setCursor(0, 0); // set cursor to first row
lcd.print("Weight[g]:"); // print out to LCD
lcd.setCursor(0, 1); // set cursor to secon row
lcd.print(i); // print out the retrieved value to the second row
}
My LCD does not display any text of symbols when i tried uploading the "hello world" codes. I really need to get this done by today. (btw i have no experience in programming)
I have merged your topics due to them having too much overlap on the same subject matter @shilividich.
In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.
The reason is that generating multiple threads on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.