Mm, I don't know if you can. analogRead() already takes some time. You might want to look into that. Same for SPI speed of the SD library. But the biggest thing, why do you keep opening and closing the damn file if you want to write fast? If you want to make a grocery list fast, do you put the note book back into the drawer after every letter?
Couple of remakes:
-Please use code tags next time ![]()
if (volts2 > 2.5){
You do know volts2 is an int and int's don't have decimals. Aka, that line is the same as:
if (volts2 > 2){