hello!
i have been working on code time, , seems working, ecxept part led's should turn on.
i have 3 sensors each has led.
what want having led turn on, when specific sensor 10% or over, total value.
for example
sensor1 = 10 sensor2= 3 sensor3= 30
now total value 43.
if sensor1 gets on 20 of total value, led1 should turn on.
sensor1 23%.
next reading shows
sensor1 = 10 sensor2= 3 sensor3= 40
now sensor1 19%. , led should turn off..
i have tried simple
sensor1/(sensor1+sensor2+senor3)*100 > 20,
digitalwrite (led1, high.)
but turning on when sensor1 above 20 reading. not 20% doing wrong?
i have been working on code time, , seems working, ecxept part led's should turn on.
i have 3 sensors each has led.
what want having led turn on, when specific sensor 10% or over, total value.
for example
sensor1 = 10 sensor2= 3 sensor3= 30
now total value 43.
if sensor1 gets on 20 of total value, led1 should turn on.
sensor1 23%.
next reading shows
sensor1 = 10 sensor2= 3 sensor3= 40
now sensor1 19%. , led should turn off..
i have tried simple
sensor1/(sensor1+sensor2+senor3)*100 > 20,
digitalwrite (led1, high.)
but turning on when sensor1 above 20 reading. not 20% doing wrong?
i have tried simplewell, isn't code, should post actual code you're trying.
sensor1/(sensor1+sensor2+senor3)*100 > 20,
digitalwrite (led1, high.)
Arduino Forum > Using Arduino > Programming Questions > Percent of constant changing total value
arduino
Comments
Post a Comment