Hey Peeps! For context, I am not really familiar with gathering data from a sensor through an Arduino. Although I have programmed some things with actuators before, I still consider myself quite a newbie, I hope someone here can help me out with this;
I am trying to use six FSR's (specifically Flexiforce) on a Arduino uno using this code: Code from another poster that I have very slightly modified to work for all six analogue pins.
Unfortunately, only A0, A1 and A2 are showing up on the Serial Plotter, while all of them do show up on the Serial Monitor. I have added pictures of my setup, what shows up on the Serial Plotter, what shows up on the Serial Monitor, and the adjusted code below.
Does anyone know how to let the readings of all six sensors show up on the Serial Plotter? Alternatively, is there a way to save the data from all six separately so I can make the graphs myself.
First of all, if you just need graphics output get rid of the labels and keep the numeric output clean.
Then, I can't find anything wrong in your code, except for the anomalous "unsigned" variable type: you'd better specify which unsigned type you need. Is it an "unsigned int"? "unsigned long"? In your case, it looks like a "byte" type is enough (ranging from 0 to 255, it's still "unsigned" and the Nsfr variable will never reach values greater than that), so I highly recommend you to replace "unsigned" with "byte".
Let's get back to your problem. I can only try to imagine that the serial plotter has a limited buffer for reading data, so making a cleaner ans shorter output could do the trick:
...
const byte PinFsr [] = { A0, A1, A2, A3, A4, A5};
const byte Nfsr = sizeof(PinFsr);
...
for (byte n = 0; n < Nfsr; n++) {
int fsr = analogRead (PinFsr [n]);
Serial.print (fsr);Serial.print(" ");
}
Give it a try and let me know.
Yeah, there are many possible ways. For example you could use a "CSV format" (e.g. using comma or semicolon to separate the values) to let you save the output to a *.csv file and open it with Excel (or any other data tool) and do everything you need to get from it. The code could also do the job for you, by saving the data in an SD card file, or sent to a NAS file accessible via FTP, or any other solution that may be useful to you.
If I understand correctly, this would be the adjusted code? If so, the Serial Plotter is not showing anything and the Serial Monitor is very chaotic, just one long horizontal string of random numbers. Though, it might very well be on me for not incorporating the code as you meant. I have tried various other ways, but none would compile.