Stop print from scrolling

First of thanks guys for the reply ..At least now I don't feel so alone with this problem .
I knew thought the hardest part of this was going to be getting across exactly what the problem is :slight_smile: In the loop there are three possible outputs . "No Motion" , "Get In" and "Get out" . No motion is always = to Zero . Get in = plus one and get out = minus one . All good so far . The last serial.println("======"); gives the output to the serial monitor .But as it's a loop each time it loops it prints the Value to the serial port so I get a continuous stream of data (mostly Zeros ) .All I'm interested in is the total number e.g. 100 people approach the camera from the right so they are plus 100 . Meanwhile 25 people approach from the left so they are minus 25 . This leaves the total at number of 75 . The sketch will happilly run and give the correct numbers but meanwhile I have a serial output about a mile long with each loop repeating . I think what I need is a way to tell the last seral.println firstly to ignore the zeros and secondly not to print if the previous number generated by the previous loop hasn't changed . Most of the answers to similar questions to this seem to only involve two possible scenarios i.e. turn a switch on or off and then use an int to store the previous value e.g. below but how to do this with my three options :frowning:

int old_something;

void loop ()
{
int something = get_my_data ();
if (something != old_something)
Serial.print (something); // display if it changed
old_something = something;
}
serial out