You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying for days to make the arduino not restart by itself while it does multiple weighing, always a few minutes after I initialize the arduino, it ends up restarting by itself for no reason.
I already checked if my code is leaking memory, I changed the load cells, I changed the power supply of my arduino, I tested it on multiple computers to see if the USB was the problem, I even tried to turn off whatdog, but without success.
The closest I came to reproducing the problem was with this code, it literally restarts my arduino by itself after run 4 times inside loop() function.
I using arduino-cli/vim for development and stty/cat for view serial output.
I've been trying for days to make the arduino not restart by itself while it does multiple weighing, always a few minutes after I initialize the arduino, it ends up restarting by itself for no reason.
I already checked if my code is leaking memory, I changed the load cells, I changed the power supply of my arduino, I tested it on multiple computers to see if the USB was the problem, I even tried to turn off whatdog, but without success.
The closest I came to reproducing the problem was with this code, it literally restarts my arduino by itself after run 4 times inside loop() function.
I using arduino-cli/vim for development and stty/cat for view serial output.
--------------- CODE ----------------------------
`#include <HX711.h>
#define MIN_WEIGHT 1 // 0.001 Kg
#define LOADCELL_DT 2
#define LOADCELL_SNK 3
#define LOADCELL_SCALE 480.1
#define LOADCELL_GAIN 128
#define LOADCELL_TARE 600
#define SERIAL_RATE 9600
HX711 loadcell;
void setup_loadcell(){
loadcell.begin(LOADCELL_DT, LOADCELL_SNK);
Serial.print(F("Tare...\n"));
loadcell.tare(LOADCELL_TARE);
loadcell.set_scale(LOADCELL_SCALE);
loadcell.set_gain(LOADCELL_GAIN);
}
void setup() {
Serial.begin(SERIAL_RATE);
setup_loadcell();
Serial.print(F("Setup ok!\n"));
}
void loop(){
delay(100);
if(loadcell.get_units() > MIN_WEIGHT){ // REMOVE < 0 GRAMS SAMPLES
Serial.print(F("Starting!\n"));
}
}`
---------- OUTPUT TERMINAL ----------
The text was updated successfully, but these errors were encountered: