void setup()
{
Serial.begin(115200); //setup serial
}
void loop()
{
// Declare variables that will store values read from each sensor
int channels[5];
//read input pins with analog values
channels[0] = analogRead(A0);
channels[1] = analogRead(A1);
channels[2] = analogRead(A2);
channels[3]= analogRead(A3);
channels[4] = analogRead(A4);
//print value on the serial monitor screen
Serial.print(channels[0]);
Serial.print(","); Serial.print(channels[1]);
Serial.print(","); Serial.print(channels[2]);
Serial.print(","); Serial.print(channels[3]);
Serial.print(","); Serial.print(channels[4]);
Serial.println(""); //line break
delay(200);
}
I already showed you the output data (the serial monitor)
all separated by commas and in the processing sketch I split them by commas again, I do get graphic output so I know its correcty, but I want to know how to make it "smooth"
I was reading over in wikipedia exponential decaying and I kind of understood it, however I dont know how to convert the concepts into code.
I've read some codes Here but when they list examples they all have like "pre-set" values, they dont include a streaming set of values (like serialevents)
thats why Im confused, I tried declaring the variable globally, but still its value should be declared inside the serial event shouldnt it? (I am assuming the code is read top-to-bottom?) therefore you cant declare values of variables that havent been stated (for exmaple if I declare the value of the global variable to equal the values read by the arduino, which havent been read since the serialevent hasnt even started)
I am not too sure about this last part tho.
should that IF structure be in some other function thats not in the serial event?