State Not Declared in Scope - Lamination Machine Debugging

Your description helps to understand how the machine is working. Though the description is not yet sufficient to be able to write code for it

Here is your description with additional questions

  1. pallet is held by a forklift at one end of the lamination table, and a sheet of material is loaded onto the table from the pallet
    Is 1. done by hand?

  2. factory employee presses a button, and the table starts to move
    is this table 1 or table 2 in your code?

  3. if delay on the sprayer is over, it starts to spray the material as it passes underneath the spray gantry
    what makes the sprayer start to spray?
    a fixed waiting time ? some kind of sensor or switch?

sprayer stops,
what makes the sprayer stop?
a fixed time or some kind of sensor or switch?

  1. table advances material to the end of the roller table
    what inititiates the advancing of the material?
    which table is this in the code table 1 or table 2?

  2. mechanical flipper arm assembly flips the material onto the second spray table
    this is done purely manual by a worker?

second spraytable
that has just run identical code and sprayed sheet of material #2 (this is not connected to the arduino)
So there is a programmable control but it is not an arduino ?

factory employee presses the manual advance button and the material is pushed through pinch rollers,
"manual advance button" is somehow contradictionary is it a manual action or a motordriven action?

landing on a pallet held by a forklift at the opposite end of the table.

Below I will write a description that has all the details that are nescessary to write code for it.
I'm very sure that this description is wrong in a part of the details. It is meant as an example to show what kind of details mus be given to really understand the functionality that you need to make it work.

A description that canbe used as a base for programming would be

machine is switched on => Arduino is powerded and executes the startup procedure
showing

machine is in idle-mode, waiting for the start-button to be pressed by a worker

start-button gets pressed by a worker
arduino makes table 1 transport one sheet into spray-position
if switch "sheet is in position to spray" is switched HIGH
arduino switches signal "start spraying" from low to HIGH which makes the spray-gantry
start spraying.

Arduino drives table 1 again forwards to advance the table 1 through spraying-gantry
if endposition is reached arduino switches off the sprayer

Ardunio drives table 1 again forward to

etc. etc.

This description must have each and every thing that works as an input to the arduino and each and every IO-pin that is used as an output by the arduino to start actions
each and every display-message that gives the worker an information
"as next step do ....."

This description must have each and every condition that starts a new action and the conditions that end an action

  • which could be simply "some time" has passed by
  • a steppermotor has done a certain number of steps
  • a button is pressed
    etc.

As soon as you have posted this detail-information I can write a piece of code that defines self-explaining names that are worth this description "beeing self-explainable.

If you would like to read more about state-machines you can read this tutorial

best regards Stefan