Serial plotter & Serial monitor question..

Have a bit of code here that outputs a square wave. Swaps a variable from 0 to 1 over and over. I turn on the serial plotter and I see a square wave just as I expect.

In my loop() I look for incoming bytes from the serial port so I can use the information to change pulse widths. But, No incoming bytes are ever "seen" by my code while the serial plotter window is active.

I can switch off the serial plotter window and turn on the serial monitor window and the I can enter numbers to switch the pulse width, everything is fine.

What I'm I doing wrong such that the inputting of bytes from the serial plotter won't work?

The code..

#include "squareWave.h"
#include "timeObj.h"

int signal;

class testWave :  public squareWave {

   public:
   virtual void pulseOn(void);
   virtual void pulseOff(void);
};


void testWave::pulseOn(void) { signal = 1; }
void testWave::pulseOff(void) { signal = 0; }

testWave ourSquareWave;
char     inBuff[100];
int      i;
timeObj  outTimer(10);

void setup() {

   signal   = 0;
   i        =0;
   ourSquareWave.setPeriod(1000);
   ourSquareWave.setPulse(250);
   ourSquareWave.setOnOff(true);
   outTimer.start();
}


void loop() {

   char  aChar;
   int   newVal;
   
   idle();
   if (Serial.available()) {
      aChar = Serial.read();                       
      if (aChar=='\n') {
         inBuff[i] = '\0';
         i = 0;
         newVal = atoi(inBuff);
         ourSquareWave.setPulse(newVal);
         Serial.print("Set pulse to : ");
         Serial.println(newVal);
      } else {
         inBuff[i++] = aChar;
      }
   }
   if (outTimer.ding()) {
      Serial.println(signal);
      outTimer.start();
   }
}

Thanks!

-jim lee

Does the serial plotter even have an input pane?

Yeah, it does!

Made a nice square wave too.

-jim lee

there's an input "pane" at the top of the Serial Monitor window
i don't see one on the Serial Plotter window
i can't open the Serial Monitor while the Serial Plotter is running

There is an input pane and popup for end-line choices at the bottom of my serial plotting window.

-jim lee

i have those options on the serial monitor window but not the plotter window

i'm using version 1.8.1 of the IDE. which version are you using?

1.8.12

-jim lee

Looks like they've added this feature in 1.8.11. No documentation anywhere that I could find, other than this YouTube video where they manipulate the green trace. Might have to experiment with this myself sometime...

EDIT: Click his link below the video to see his code.

Yup, looked at his code. Looks kinda' like mine. But on mine Serial.available() never returns true. Possibly its because I'm running a teensy? Donno'. I'll have to try mine on an UNO.

-jim lee