Arduino help - how to use dtostrf () function

Hey everyone, I am measuring voltage over 2 analog inputs on my arduino uno. 

I want to be able to do this wirelessly, so I got a microSD shield. I am trying to get it to send the data over to the SD after measuring it and putting it into voltage, but I can't figure out how to use the dtostrf function properly. I am really new to arduino and programming in general, and this project is time sensitive, so don't give me any answers like go read a book. How do I properly use it in this context?

Thanks

Here is the void loop part of my most recent failed attempt:

void loop()
{
  //string for assembling the data to log:
String dataString = "";
  //read 6 sensors and append to string:
  for (int analogPin = A0; analogPin < A2; analogPin++)
  {
    int sensor = analogRead(analogPin);
    float sensorValue = ((float)(sensor) *(5.0/1023.0));
   dtostrf(sensorValue, A0, A1);
    if (analogPin < A2) {
      dataString += " ";
     
    }
  }
    /*open file-only one can be open at once
    close this one before opening another*/
    File dataFile = SD.open("datalog.txt", FILE_WRITE);
   
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    //print to serial monitor as well.
    Serial.println(dataString);
  }
  //if file doesn't open, print pop up error
  else {
    Serial.println("error opening datalog.txt");
  }
delay(300000);
}

caitlinsdad3 years ago