Hi all,
first time poster but long time reader and user
anyway i have a problem with math, im trying to convert feet to metres on a button press. at the minute i have an array counting from 0.0ft to 10.6 ft and the corresponding metre code in a switch case like the example, the switch case points to a function under as void one(); (see the example).
now the obvious problem straight away is 12 inches times 10 feet = a lot of switch cases and a bloated code. but does make it easy writing to sd card and lcd screen,
I tried several ways to count up but none work, i dont know enough about arrays and bits to even start a code, i have tried examples and studying the process of it but it just doesnt click?
I know there is a simple way to count up through this range without hundreds of lines of code. can anybody help me with this? i cant post my code as it keeps changing forms and its way to long but an example of my switch case is as follows
//example
switch (count){ //my generic switch code, counts up with button press
case 1:
one(); //points to below example shortened
break;
}
//void one as example, excuse the mistakes its from memory and does work
void one(){
lcd.clear();
lcd.setCursor(0,0);
lcd.write ("0.1ft or 0.03 mtr);
myfile.(stat.txt,READ_WRITE);
myfile.write ("0.01ft or 0.03mtr")
myfile.close();
}
i have hundreds of these, can you help!