FSR pressure mapping assistance

I am a relative novice when it comes to arduino and processing in general. I need need help graphically displaying three lines that correlate to the output forces from 3 different force sensors in different colors on the same graph. I am having trouble making them distinguishable from each other. This is the code i have so far:
Arduino:
void setup() {
Serial.begin(57600);
}

void loop() {
for (int channel=0; channel <=2; channel++) {

int sensorValue = analogRead(channel)/4;
Serial.print(sensorValue, DEC);
if (channel < 2) {
Serial.print("\t");
}
delay(8);
}
Serial.println();
}

Processing Code:
import processing.serial.*;

Serial myPort;
int arrayLength = 3;
int sensorValues = new int[arrayLength];
int hPosition = 0;
int displayChannel0 = 0;
int displayChannel1 = 1;
int displayChannel2 = 2;
String dataSet;
int threshold = 50;
void setup () {
size(400, 300);

println(Serial.list());
myPort = new Serial(this, Serial.list()[5], 57600);

myPort.clear();
myPort.bufferUntil(’\r’); // ASCII 13

PFont myFont = createFont(PFont.list()[1], 24 );
textFont(myFont);
smooth();
background(0);
}

void draw () {
graph(sensorValues[displayChannel0]);
graph(sensorValues[displayChannel1]);
graph(sensorValues[displayChannel2]);
}

void serialEvent(Serial myPort) {
String serialString = myPort.readStringUntil(’\n’);
if (serialString != null) {
dataSet = serialString;
String numbers = split(serialString, “\t”);
for (int i = 0; i < numbers.length; i++) {
if (numbers.length <= arrayLength) {
numbers = trim(numbers*);*
int diff = abs(sensorValues - int(numbers*));*
* if (diff > threshold) {*
* writeToFile();*
* }*
sensorValues = int(numbers*);*
* }*
* }*
* }*
}

void graph (int numberToGraph) {
* stroke(0,255,0);*
* line(hPosition, height, hPosition, height - numberToGraph);*
* if (hPosition >= width) {*
* hPosition = 0;*
* background(0);*
* }*
* else {*
* hPosition++;*
* }*
}

void writeToFile() {
* String[] newData = new String[1];*
* newData[0] = timeStamp();*
* newData[0] += “\t”;*
* newData[0] += trim(dataSet);*

* String[] dataSoFar = loadStrings(“dataFile.txt”);*
* if (dataSoFar != null) {*
* String[] dataToWrite = new String[dataSoFar.length + newData.length];*
* for (int s = 0; s < dataSoFar.length; s++) {*
* dataToWrite = dataSoFar~~;~~*
~~ }~~
~~ for (int s = dataSoFar.length; s < dataToWrite.length; s++) {~~
dataToWrite = newData[s-dataSoFar.length];
~~ }~~
~~ saveStrings(“dataFile.txt”, dataToWrite);~~
~~ }~~
~~ else {~~
~~ newData[0] = “Time:\tSensor 1\tSensor 2\tSensor 3\tSensor 4\tSensor 5”;~~
~~ saveStrings(“dataFile.txt”, newData);~~
~~ }~~
}

Any help with this would be very much appreciated

Did you even read that after you posted?- please use code tags else some of the characters get interpreted as markup.

Without code tags the code’s gone crazy in 3 ways that I can see:

  • There’s a smiley in the middle: that’s an 8 followed by a )
  • It goes all italic in the middle: index i in square brackets
  • It gets all struck through at the bottom: index s in square brackets

Select your code and hit the code tag icon: it’s the one with the <> above the :neutral_face: