So let me start this out by saying that i have a sketch with way to many "else if" statements and it won't upload to my mega because of the size (5.1MB) . Also i cant shrink it or ill loose way too many conditions. Im trying to figure if/how i can read the data from a SD card instead of having if statements. Can arduino search for specific values on an sd card?
The conditions would be X, Y, Z and the output values are a, b, c, d.
Let me know if you have any ideas. If there is nothing i can do then i can go back to my original program, but my goal was to make the result come faster. Also i have a raspberry pi im willing to use for this, but i dont know where to start with that.
It's basically coordinates and angles. There are about 88 million combinations but i cut that down to 74,000 already. The reason why i need as many conditions is so i can get it to be as accurate as possible with the locations i enter. I know there is probably duplicates but not enough to make the sketch smaller.
I guarantee i probably need something with more computing power but i want to see if i have any more options with external storage.
if ((x==2)&&(y==3)&&(z==1.2)) {
a=3;
b=7;
c=100;
d=3;
} else if...
and so on.
Pretty much a ton of those that have different condition values for x,y,z and different outputs of a,b,c,d. Im not hiding anything. Thats literally all my code is but repeated with different values about 74,000 times.
Hey Delta_G thanks for the help, but my question was simple. I wanted to know whether i could read conditions x,y,z on an SD and know my values would be A,B,C,D. If the answer to that is no then thats all i can ask for. All i have is a ton of x,y,z values that go along with a,b,c,d values then it serial prints them at the end.
I'm not trying to frustrate you but seriously thats what i have. And again, thanks for the help. You helped me out the other day as well.
"} else if ((-0.87==x)&&(2.05==y)&&(5.31==z)){a=5;b=-90;c=-170;d=0;
} else if ((-1.3==x)&&(2.04==y)&&(5.31==z)){a=7.5;b=-90;c=-170;d=0;
} else if ((-1.73==x)&&(2.03==y)&&(5.31==z)){a=10;b=-90;c=-170;d=0;
} else if ((-2.15==x)&&(2.01==y)&&(5.31==z)){a=12.5;b=-90;c=-170;d=0;
} else if ((-2.57==x)&&(1.99==y)&&(5.31==z)){a=15;b=-90;c=-170;d=0;
} else if ((-2.99==x)&&(1.97==y)&&(5.31==z)){a=17.5;b=-90;c=-170;d=0;
} else if ((-3.4==x)&&(1.94==y)&&(5.31==z)){a=20;b=-90;c=-170;d=0;
} else if ((-3.8==x)&&(1.9==y)&&(5.31==z)){a=22.5;b=-90;c=-170;d=0;
} else if ((-4.2==x)&&(1.87==y)&&(5.31==z)){a=25;b=-90;c=-170;d=0;
} else if ((-4.59==x)&&(1.83==y)&&(5.31==z)){a=27.5;b=-90;c=-170;d=0;
} else if ((-4.97==x)&&(1.78==y)&&(5.31==z)){a=30;b=-90;c=-170;d=0;
} else if ((-5.34==x)&&(1.74==y)&&(5.31==z)){a=32.5;b=-90;c=-170;d=0;"
Here's a little piece of the code. It's just a bunch of these. I have some other ideas but nothing written out yet. I'll send more when i write out my other sketches.
And if theres a better way to write else if statements then i'm all ears. It compiles fine but obviously takes too much space. Might be able to have the outputs be one variable that i can split into a,b,c,d at the end.
so 10029034 a=10 b=02 c=903 d=4. I dont know, just an idea to save some space.
It's actually a school project. Im just trying to find answers to questions nobody has asked (that ive seen). I also check periodically to see if i can help others. Most of the time someone beats me to it though. I mean i really dont see the issue in asking about ways to read from an SD card.
But i definitely get it... i gotta go back to the drawing board and see if i can find a better solution. I know i need to step up to something with more computing power though and use the arduino as the controller.
Because what it is doesn't answer my questions that i had. I'm trying to be a nice guy here and i try to help the arduino community. I dont plan on making any money off of this code. So can we please end this on good terms.