Storing serial monitor values in an array

Hi,

I'm currently doing a project for my study to calculate the effeciency of a solar cell,
to do that I'm measuring the voltage coming out of the cell.

I worked out how to get the values in the serial monitor, but now I'm trying to store those values in an array and transfer them to python so I can analyse the data.
I tried a few things but they didn't work.

This is what my serial monitor shows:

10:40:36.379 -> Voltage= 0.00
10:40:36.432 -> Voltage= 0.04
10:40:36.432 -> Voltage= 0.07
10:40:36.432 -> Voltage= 0.22
10:40:36.479 -> Voltage= 0.30
10:40:36.479 -> Voltage= 0.39
10:40:36.479 -> Voltage= 0.43
10:40:36.532 -> Voltage= 0.44
10:40:36.532 -> Voltage= 0.47
10:40:36.532 -> Voltage= 0.47
10:40:36.532 -> Voltage= 0.49
10:40:36.579 -> Voltage= 0.49
10:40:36.579 -> Voltage= 0.50
10:40:36.579 -> Voltage= 0.50
10:40:36.639 -> Voltage= 0.50
10:40:36.639 -> Voltage= 0.51
10:40:36.639 -> Voltage= 0.51
10:40:36.639 -> Voltage= 0.51
10:40:36.685 -> Voltage= 0.51
10:40:36.685 -> Voltage= 0.51
10:40:36.733 -> Voltage= 0.51
10:40:36.733 -> Voltage= 0.51
10:40:36.733 -> Voltage= 0.51
10:40:36.733 -> Voltage= 0.51
10:40:36.781 -> Voltage= 0.51
10:40:36.781 -> Voltage= 0.52

Thanks in advance,
Sincerely,

Hajo Wennekes

Welcome to the forum

See Serial input basics - updated and post your current sketch

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

"My car wouldn't start his morning.
I tried a few things, but they didn't work.

My car is white."

See the problem here?

yeah, it should not be white, right? :slight_smile:

1 Like

Yeah, red car always starts, fact

yes, sorry for the inconvinience.

I actually don't have an error that needs fixing.

I don't know how to solve the task in the first place.

Do you know how to deal with an array in C++? here is a small example filling up 20 values in an array

const byte maxCount = 20;
int memory[maxCount];

void setup() {
  Serial.begin(115200); Serial.println();

  for (byte i = 0; i < maxCount; i++) {
    memory[i] = analogRead(A0);
  }

  Serial.println("The acquired data in the arrary is");
  for (byte i = 0; i < maxCount; i++) {
    Serial.print("memory["); Serial.print(i); Serial.print("] = ");
    Serial.println(memory[i]);
  }
}

void loop() {}

Did you read the Serial Input Basics tutorial?

Maybe if you described what you've done, and what you want to do.
Perhaps post the code you've got?

And describe what that means.

It will probably a good idea to implement the array at the Python side. Most Arduinos (you did not mention which one you're using) have limited memory; e.g. an array of 500 floats will not work on an Uno.