I have been working on a code for some time, and everything seems to be working, ecxept the part where my LED's should turn on.
I have 3 sensors that each has an LED.
What i want is having a LED turn on, when a specific sensor is 10% or over, the total value.
Sensor1 = 10 Sensor2= 3 Sensor3= 30
Now total value is 43.
If Sensor1 gets over 20 of total value, LED1 should turn on.
Sensor1 is 23%.
Next reading shows
Sensor1 = 10 Sensor2= 3 Sensor3= 40
Now Sensor1 is 19%. and its LED should turn off..
I have tried some simple
sensor1/(sensor1+Sensor2+senor3)*100 > 20, digitalWrite (led1, high.)
but what it does is turning on when sensor1 is above 20 reading. not 20% What am i doing wrong?