I am working on troubleshooting the handling of sensor data on my project. Since connecting and disconnecting everything to correct my errors in logic, then try again, is a royal pain with this project (can't be done in my office), I've hooked up the sensors and outputted a bunch of data to a CSV file (copied and pasted from the Serial Monitor).
The CSV file looks like this:
0,695,730,774
1,695,724,776
2,692,724,774
3,692,720,774
4,687,720,772
5,687,710,772
....
64321,702 ,610,790
Column 1 is a time stamp (from a millis() call) and the other columns are the raw readings from 3 different sensors.
The data I receive from the sensors in a real scenario will be fairly consistent, but getting them to interact together properly and cause the "other stuff" will require a fair bit of fiddling, testing, cursing, and trying new stuff. I already have a good sense of what I need to do, but I know there will be a bunch of fiddling.
Is there a way to EASILY (I'm a noob) read this CSV file and stick the values into 4 (long) int variables
For example, at the end of the reading, this would be the values of each variable
long int currentTime = 64321
int currentSensor1 = 702
int currentSensor2 = 610
int currentSensor3 = 790
If I can get that, I can probably get started on the rest. I do not need to keep the entire history in the Arduino Uno - the current readings will be put into element 0 of a 20 element array like this which is about all the history I need:
for (int i = 19 ; i >=0 ; i--) {
timeHistory[i] = timeHistory[i-1];
sensor1History[i] = sensor1History[i-1]
//....
}
timeHistory[0] = currentTime;
/....
It would be quite nice if it can be done in close to "real time". Sensor 1 will force an LED to blink whenever it gets over 740 during my testing (it's measuring the speed of a wheel) so I will be using that to get a visual sense of how the others are working.
Thanks.