Hi, Sorry for not beening specific, i am new to this. the problem is the first part of the code, one for interact with sensor. I dont know how to write it. This is my best try... it is modification of several examples. I was hoping for some advices. code for mode 1 and 2 work Just fine i Just cant connect it all for sensor to recognize. hope i explain it better tjan last time
User 12369614
Posts
-
arduino sensor -
arduino sensorHello, I am having trouble with my current project and need your help. Weight sensor is is connected to arduino uno board and to several light sources. goal is: sensor activated-mode1, sensor unactive-mode 2 for 5 seconds. Mode 1 is blinking light and mode 2 is normal light. I have written code sensor activation, for mode1 and mode 2 but it cant get it to work. What im i missing? sensor : (www.elecrow.com/weight-sensor-kit-3kg-p-883.html) code: sensor activation: #include <Hx711.h> #define LED 6 #define ADC1 A2 #define ADC2 A3 #define THRESHOLD 100. Hx711 scale(ADC1, ADC2); void setup() { pinMode(LED, OUTPUT); } void loop() { digitalWrite(LED, HIGH); delay(500); if(scale.getGram() > THRESHOLD) digitalWrite(LED, LOW); delay(500); } mod1 blinking int led = 13; void setup() { pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(500); // wait digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(500); // wait } mod 2 light for 5 sec int led = 13; void setup() { pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); delay(0); digitalWrite(led, LOW); delay(5000); }