Hi there i'm getting an error in my code for a load cell that will light up when a mass is on it. This is my code
/*
HX711_ADC
Arduino library for HX711 24-Bit Analog-to-Digital Converter for Weight Scales
Olav Kallhovd sept2017
*/
/*
Settling time (number of samples) and data filtering can be adjusted in the config.h file
For calibration and storing the calibration value in eeprom, see example file "Calibration.ino"
The update() function checks for new data and starts the next conversion. In order to acheive maximum effective
sample rate, update() should be called at least as often as the HX711 sample rate; >10Hz@10SPS, >80Hz@80SPS.
If you have other time consuming code running (i.e. a graphical LCD), consider calling update() from an interrupt routine,
see example file "Read_1x_load_cell_interrupt_driven.ino".
This is an example sketch on how to use this library
*/
#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif
//pins:
int ledPin = 13;
const int HX711_dout = 3; //mcu > HX711 dout pin
const int HX711_sck = 2; //mcu > HX711 sck pin
//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);
const int calVal_eepromAdress = 0;
unsigned long t = 0;
void setup() {
pinMode(ledPin,OUTPUT);
pinMode(HX711_ADC,OUTPUT);
Serial.begin(57600); delay(10);
Serial.println();
Serial.println("Starting...");
LoadCell.begin();
float calibrationValue; // calibration value (see example file "Calibration.ino")
// calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
#if defined(ESP8266)|| defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom
#endif
//EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom
unsigned long stabilizingtime = 2000; // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
LoadCell.start(stabilizingtime, _tare);
if (LoadCell.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
while (1);
}
else {
LoadCell.setCalFactor(calibrationValue); // set calibration value (float)
Serial.println("Startup is complete");
}
}
void loop() {
if (digitalRead(HX711_ADC)==HIGH)
(
digitalWrite(ledPin,HIGH);
)else
(
digitalWrite(ledPin,LOW);
)
}
}
and this is the error im getting
Arduino: 1.8.15 (Windows 10), Board: "Arduino Uno"
C:\Users\suddh\AppData\Local\Temp\arduino_modified_sketch_933424\Read_1x_load_cell.ino: In function 'void setup()':
Read_1x_load_cell:39:20: error: expected primary-expression before ',' token
pinMode(HX711_ADC,OUTPUT);
^
C:\Users\suddh\AppData\Local\Temp\arduino_modified_sketch_933424\Read_1x_load_cell.ino: In function 'void loop()':
Read_1x_load_cell:66:28: error: expected primary-expression before ')' token
if (digitalRead(HX711_ADC)==HIGH)
^
Read_1x_load_cell:68:28: error: expected ')' before ';' token
digitalWrite(ledPin,HIGH);
^
Read_1x_load_cell:69:3: error: expected primary-expression before ')' token
)else
^
Read_1x_load_cell:72:5: error: expected primary-expression before ')' token
)
^
C:\Users\suddh\AppData\Local\Temp\arduino_modified_sketch_933424\Read_1x_load_cell.ino: At global scope:
Read_1x_load_cell:74:1: error: expected declaration before '}' token
}
^
exit status 1
expected primary-expression before ',' token
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.