I'm trying to upload this code and it works properly but I can't see anything on my serial plotter

const int AnalogIn_Pin0=  A0;
const int AnalogIn_Pin1=A1;
const int Pwmout_PIN=11;
float AnalogIn_Val0=0;
float AnalogIn_Val1=0;
int Pwmout_Val=0;
float Error=0;
float ErrorInteg=0;
float Control=0;
float ControlFilt=0;
float kp=0.2;
float Pole =-10;
float Ki =0.01;
int deltaT=0.01;
int deltaT_ms=(int)deltaT*1000;

void setup() {
  pinMode (Pwmout_PIN,OUTPUT);
  Serial.begin (9600);

void loop() {
  AnalogIn_Val0=(float)constrain (analogRead(AnalogIn_Pin0),0,600);
  Error= (AnalogIn_Val0-AnalogIn_Val1);
  ControlFilt=kp*Error+Ki *ErrorInteg;
  Pwmout_Val= constrain (map ((int)ControlFilt,0,1023,0,255),0,220);
 analogWrite (Pwmout_PIN,Pwmout_Val);
 Serial.print( Pwmout_Val);
 delay (deltaT_ms); 

  • works properly ... then why did you post your question?
    – jsotola
    Commented Oct 15, 2018 at 16:24
  • you do not say what you actually see ..... maybe your plotter is defective
    – jsotola
    Commented Oct 15, 2018 at 16:25
  • it's not plotting, the hardware works properly
    – AMR
    Commented Oct 15, 2018 at 16:49
  • 2
    It looks like that will just output a long string of numbers. No separators between fields, no separators between records (like: 5678298549328756238746524983759823462938746238974692387463298574369587234658723468734629375605237643724123046503453948765.... How is anything supposed to make sense of the data?
    – Majenko
    Commented Oct 15, 2018 at 16:52

1 Answer 1


You must have each set of data point (or points) on a separate line and if you are plotting more that one value you need a space or a tab between each value.

So to have 3 lines on your plot, I think you want this:

 Serial.print(' ');
 Serial.print(' ');

The output in the serial monitor should be something like this:

123 456 789
234 567 901

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.