Some boards can put out some spurious serial output on startup. That could caused the plot you show in your screenshot. The situation might be more clear if you look at the data in Serial Monitor.
You might be able to solve the problem by adding a short delay in your setup function:
The second "previousValue" is a holdover (why? I do not know) from the previous "run" of the sketch... close the IDE and start where @ptillisch showed the format... and how did that sketch even compile?