code:
const float referenceVolts = 5.0; // the default reference on a 5-volt board
int row_excel = 0; // number of lines
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("CLEARDATA"); // clear excel sheet
Serial.println("A,B,C,");
}
void loop() {
// put your main code here, to run repeatedly:
static const uint8_t analog_pins[] = {A0, A1, A2, A3, A4};
for (int i = 0; i < 5; i++)
{
int val = analogRead(analog_pins[i]);
float volts = (val / 1023.0) * referenceVolts; // calculate the ratio
Serial.println(volts); // print the value in volts
I can't figure out the question(s) here, but if you want to present data in a certain way in Excel, then you can always create a sample Excel sheet of how you want it to look and then export that sheet as a CSV file. Then open you favourite text editor and see how the data has been laid out. Then simply have your sketch output the data in a similar format.
Separate the numbers with a comma instead of newline.
for (int i = 0; i < 5; i++)
{
int val = analogRead(analog_pins[i]);
float volts = (val / 1023.0) * referenceVolts; // calculate the ratio
Serial.print(volts); // print the value in volts
if (i < 4)
Serial.print(',');
}
Serial.println();