Howdy, all. I hope this is the right place to post this question.
As I move forward with my project and design I came up with the following question. Can I wire a dip switch on my board that will tell my particle device what formula/part of the code to run?
Example. I have multiple size meters. They will each have a different flow rate, and reading scale. Instead of having different code with each size meter I want to have a dip switch that can be selected to tell my particle code which formula to use base on which dip switch is selected.
I would use a 4 to 5 channel dip switch but not sure what pins to write those too as well as if they should be set to high or low⦠or if this will even work.
Here is my original code.
float flow = map(adc,2139.0, 10614.0, 0.0, 200.0);
String F = String::format("%.1f", flow);
Lets say that would be for a one inch meter with a flow of 0 to 200. I would set this as dip swith 2. Example
I would have other sizes so the smaller unit would be dip switch 1 and the code obviously more complicated than this but her is a general idea.
ifā¦
dip switch set to 1 then pin B2 is High.
thenā¦
float flow = map(adc,1000.0, 8000.0, 0.0, 40.0);
String F = String::format("%.1f", flow);
ifā¦.
dip switch set to 2 then Pin B3 is High
thenā¦
float flow = map(adc,2139.0, 10614.0, 0.0, 200.0);
String F = String::format("%.1f", flow);
and so on.
Any help or suggestions is appreciated. If someone already did this please link me to the post. I was not able to find anything yet but I may have missed it.
Thank you,
Tom


