Program is not Returning to Loop after calling a function

So I am building a lamination table that will laminate 4x8 sheets of material. The design incorporates a pushbutton interface with controls for momentary advance, momentary reverse, laminate, and reset table (if the material needs to be sprayed with adhesive again). In essence, when laminate (spray() and driveTable()) is called, two roller tables begin to motivate (move the material forward) and a sprayer begins to sweep back and forth on a gantry assembly (spraying side to side as material passes underneath). If tableHome is called, the table moves the material back to the starting position so "laminate" (spray() and driveTable()) can be called again.

I have written firmware that has been working really well, but every time a function is called other than manual advance and manual reverse, the program gets hung up and does not return to loop. This means that every time these functions are called, I have to press the reset button on the Arduino. I would prefer to never have to press the reset button, but I am not sure how to accomplish this, despite many troubleshooting efforts. Guidance is much appreciated.

#include <AccelStepper.h>
#include <LiquidCrystal.h>
#include <StateMachine.h> 

//LCD Screen Setup
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
unsigned int lcdStatus;
bool advanceHasRun = false;
int reverseHasRun = false;
int idleingHasRun = false;

//motor decleration
AccelStepper sprayer(1, 35, 33); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5 .   ////37 now 33, 39 now 35
AccelStepper table1(1, 43, 41);  // 1, pulse pin, direction pin
AccelStepper table2(1, 47, 45);  // 1, pulse pin, direction pin

//const int motorEnable = 10;

/////////////////////////start button
int button1 = 52;
int button1state = 0;

/////////////////////////boolean switches
bool sprayerOff = true;
bool tableOff = true;
bool tableHomeOff = true;
bool sprayHomeOff = true;

/////////////////////////table1 manual control
//forwardButton = t1f = 49
//reverseButton = t1r = 51
int forwardButton = 49;
int reverseButton = 51;
//t1fstate = forwardButtonStatus = 0
//t1rstate = reverseButtonStatus = 0
int forwardButtonStatus = 0;
int reverseButtonStatus = 0;

/////////////////////////reset buttons
// this is becoming home buttons, and has been renamed. old variable names are slashed out

//t2f = sprayerResetButton = 50
//t2r = tableResetButton = 53
int sprayerResetButton = 50;
int tableResetButton = 53;
//t2fState = sprayerResetStatus = 0
//t2rState = tableResetStatus = 0
int sprayerResetStatus = 0;
int tableResetStatus = 0;

//////////////////////////table tuning
int tableSpeed = 10000;     //table overall speed // previously set to 900
int tableAccel = 5000;    //changed from 1000 to 2000 to get more table speed

int spraySpeed = 10000;  //sprayer overall speed
int sprayAccel = 2000;   //accelleration rate .   //previously set to 10000

//////////////////////////Time based longs and ints
long previousMillis = 0;
long sprayHomeTime = 1000;
long tableHomeTime = 80000;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     SETUP    ///////////////////////////////////////////////////////////////

void setup() {
  
  //Initalize LCD screen
  //first set the LCD's number of colums and rows:
  lcd.begin(16, 2);
  Serial.begin(9600);
  startUpScreen();
  
 //////////////////////////////////////INITALIZE STEPPERS////////////////////////////////////
  sprayer.setAcceleration(sprayAccel);
  sprayer.setMaxSpeed(spraySpeed);
  sprayer.moveTo(1800);     //sets limit on reverse distance 
  

  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
//  table1.moveTo(25000);                /// changed from 50000 to 70000 to see if table will advance
//
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
//  table2.moveTo(45000);

  pinMode (button1, INPUT);

  pinMode (forwardButton, INPUT);
  pinMode (reverseButton, INPUT);
  pinMode (sprayerResetButton, INPUT);
  pinMode (tableResetButton, INPUT);
  
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     LOOP     ///////////////////////////////////////////////////////////////


void loop() {

///////////////////////////   MANUAL CONTROL    ////////////////////////////

  //check status of forward button, if high, advance
  forwardButtonStatus = digitalRead(forwardButton);
  if (forwardButtonStatus == HIGH) {
    table1Advance();
    table2Advance();
    if (advanceHasRun == false){
      advanceScreen();
    }
  }

  //check status of reverse button, if high, reverse
  reverseButtonStatus = digitalRead(reverseButton);
  if (reverseButtonStatus == HIGH) {
    table1Reverse();
    table2Reverse();
    if (reverseHasRun == false){
      reverseScreen();
    } 
    //idleScreen();
  }


///////////////////////////////    RESET    ////////////////////////////////

  tableResetStatus = digitalRead(tableResetButton);
  if (tableResetStatus == HIGH) {
    tableHomeOff = !tableHomeOff; 
    resetScreen();
  }
  while (tableHomeOff == false){
    tableHome();
  }

  ///send the sprayer to the starting position if right set left button is pressed
//  sprayerResetStatus = digitalRead(sprayerResetButton);
//  if (sprayerResetStatus == HIGH) {
//    sprayHomeOff = !sprayHomeOff;
//  }
//  while (sprayHomeOff == false) {
//    sprayHome();
//  } 

////////////////////////    START SEQUENCE    /////////////////////////////////

  button1state = digitalRead(button1);
  if (button1state == HIGH) {
//    tableOff = !tableOff;
//    sprayerOff = !sprayerOff;
      tableOff = false;
      sprayerOff = false;
      laminationScreen();
  }
  while (sprayerOff == false & tableOff == false) {
    spray();
    driveTable();
  }
  
  if (forwardButtonStatus == LOW & reverseButtonStatus == LOW & button1state == LOW & tableResetStatus == LOW){
    idleScreen();
  }
}
//
//   When the two directional buttons are pressed, both tables advance and reverse in sync with eachother 
//

//STATUS: Complete and working properly, but slow due to motor load. 


//advance function, table one
void table1Advance() {
  table1.setSpeed(10000);
  table1.run();
}

//reverse function, table one
void table1Reverse() {
  table1.setSpeed(-10000);
  table1.run();
}

//advance function, table two
void table2Advance() {
  table2.setSpeed(10000);
  table2.run();
}

//reverse function, table two
void table2Reverse() {
  table2.setSpeed(-10000);
  table2.run();
}
//
//
//   When the start button is pressed, the table drive function and the spray function are called. 
//   The sprayer is set with a delay, so that the material advances to the sprayers before the sprayers begin spraying. 
//   Sprayer begin code will be written once the spray guns are mounted. 
//
//   changed spray delay 
//


long sprayTime = 43900;   // changed from 45000 to 30000 to see if table movement distance is affected, it shortened the overall movement by roughly three feet, readjusted to 43000, very close, again to 53900
long tableTime = 80000;   // change from 90000 to 80000 did not affect distance of table movement
long sprayDelay = 7000;   //delay sprayer until table has correctly positioned materials // CHANGED TO 6000 from 7000


/////////////////build out idle state ()
int idleSpeed = 0;
int idleAccel = 0;
int idleDistance = 0;


  
//function that controls sprayer in "start" state
void spray() {
  unsigned long currentSprayMillis = millis();
  if  (currentSprayMillis - previousMillis > sprayDelay) {
    sprayer.setMaxSpeed(spraySpeed);
    sprayer.setAcceleration(sprayAccel);
    sprayer.run();
    //Serial.println("sprayer is running"); //program responded here, motors slowed down immediately
    if (sprayer.distanceToGo() == 0){
      sprayer.moveTo(-sprayer.currentPosition());
      sprayer.run();
      Serial.println("sprayer is running"); //program responded here, did not slow motors
    }
    if (currentSprayMillis - previousMillis > sprayTime + sprayDelay) {  //deleted "+ spray delay) from end of perentheses
      sprayerOff = true;
      Serial.println("sprayer is off");
      previousMillis = currentSprayMillis;
    }
  }
}



//function that controls table in "start" state
void driveTable() {
  unsigned long currentTableMillis = millis();
  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  //table1.moveTo(33000); // driver set to 4 microsteps   
  table1.moveTo(20000);   // driver set to 8 microsteps //previously set to 16500
  
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
  //table2.moveTo(48000); // driver set to 4 microsteps
  table2.moveTo(24000);   //driverr set to 8 microsteps // previously 24700
  
  table1.run();
  table2.run();

  if (table1.distanceToGo() == 0 & table2.distanceToGo() == 0){
    idleScreen();
  }
}




//  if (currentTableMillis - previousMillis > tableTime) {
//    Serial.println("tableDrive is off");
//    tableOff = true;
//    sprayerOff = true;
//    idleScreen();
//    previousMillis = currentTableMillis;
//  }




void idleState() {
  sprayer.setMaxSpeed(idleSpeed);
  sprayer.setAcceleration(idleAccel);
  sprayer.moveTo(idleDistance);

  table1.setMaxSpeed(idleSpeed);
  table1.setAcceleration(idleAccel);
  table1.moveTo(idleDistance);               

  table2.setMaxSpeed(idleSpeed);
  table2.setAcceleration(idleAccel);
  table2.moveTo(idleDistance);
  Serial.println("idling");
}
//
//
//sends everything back to starting position, aka RESET
//
//

// homing functions


//spray home runs on pin 50
//table home runs on pin 53

int t2RewindDistance = -24700;
int t1RewindDistance = -28000;         ////////-25900;

void tableHome() {
  unsigned long currentTableResetTime = millis();
  table1.setMaxSpeed(tableSpeed);
  table2.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  table2.setAcceleration(tableAccel);
  table1.moveTo(t2RewindDistance);   //driver set to 8 microsteps // previously set to -24500
  table2.moveTo(t1RewindDistance);   //driverr set to 8 microsteps
  table1.run();
  table2.run();
  if (table1.distanceToGo() == 0){
    idleScreen();
  }
}

void idleScreen(){
  lcd.print("Status:");
  lcd.setCursor(0, 2);
  lcd.print("Ready to proceed");
  //Serial.println("idling, ready to proceed");
}


void startUpScreen(){
  lcd.print("SPRAY TABLE V2.0");
  lcd.setCursor(0, 2);
  lcd.print("INITALIZING...");
  Serial.println("Startup complete");
  delay(500);
  idleScreen();
}


//unsigned long advanceCount;
//int previousAdvanceCount = 0;

void advanceScreen(){
    lcd.print("STATUS:      ");
    lcd.setCursor(0, 2);
    lcd.print("Advancing       ");
    advanceHasRun = true;
    reverseHasRun = false;
    Serial.println("advancing");
}


void reverseScreen(){
    lcd.clear();
    lcd.print("STATUS:        ");
    lcd.setCursor(0, 2);
    lcd.print("Reversing       ");
    reverseHasRun = true;
    advanceHasRun = false;
    Serial.println("reversing");
}


void laminationScreen(){
  lcd.print("Status:");
  lcd.setCursor(0,2);
  lcd.print("Laminating       ");
  if (tableOff == true & sprayerOff == true){
    idleScreen();
  }
}


void resetScreen(){
  lcd.clear();
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Table Resetting"));
}

Please give a specific example of such a function, and explain how you know that it does not return.

Program hangs are often caused by improper use of interrupt routines, writing to memory outside of array bounds, and running out of read/write memory.

That latter can be often fixed by ALWAYS using the "F" macro in lines like these. There are far too many of them.
Serial.println("advancing");
lcd.print("SPRAY TABLE V2.0");

The symptoms you describe have all the hallmarks of a while loop that never ends

Please edit your original post and add code tags the the whole of the sketch to make it easier to copy for analysis

Please copy/paste the compiler output, showing memory usage.

For instance, under the comment "////start sequence////" in the void loop(), I call driveTable() and spray(). When these functions are called, the machine executes its task properly. After that is complete, let's say I have noticed that the amount of adhesive spray on the material is insufficent, so I press the tableResetButton which calls tableHome() to move the material back to its starting position. When I press the tableResetButton, nothing happens. However, if I press the reset button on the Arduino, and then press the tableResetButton, the machine properly executes tableHome().

Please fix your post as requested above. It is too difficult to scroll through the various bits.

I press the tableResetButton, nothing happens

Sounds like an interrupt problem, but fix your post first.

  while (tableHomeOff == false)
  {
    tableHome();
  }

I don't see where the value of tableHomeOff is changed in the tableHome() function


#include <AccelStepper.h>
#include <LiquidCrystal.h>
#include <StateMachine.h> 

//LCD Screen Setup
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
unsigned int lcdStatus;
bool advanceHasRun = false;
int reverseHasRun = false;
int idleingHasRun = false;

//motor decleration
AccelStepper sprayer(1, 35, 33); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5 .   ////37 now 33, 39 now 35
AccelStepper table1(1, 43, 41);  // 1, pulse pin, direction pin
AccelStepper table2(1, 47, 45);  // 1, pulse pin, direction pin

//const int motorEnable = 10;

/////////////////////////start button
int button1 = 52;
int button1state = 0;

/////////////////////////boolean switches
bool sprayerOff = true;
bool tableOff = true;
bool tableHomeOff = true;
bool sprayHomeOff = true;

/////////////////////////table1 manual control
//forwardButton = t1f = 49
//reverseButton = t1r = 51
int forwardButton = 49;
int reverseButton = 51;
//t1fstate = forwardButtonStatus = 0
//t1rstate = reverseButtonStatus = 0
int forwardButtonStatus = 0;
int reverseButtonStatus = 0;

/////////////////////////reset buttons
// this is becoming home buttons, and has been renamed. old variable names are slashed out

//t2f = sprayerResetButton = 50
//t2r = tableResetButton = 53
int sprayerResetButton = 50;
int tableResetButton = 53;
//t2fState = sprayerResetStatus = 0
//t2rState = tableResetStatus = 0
int sprayerResetStatus = 0;
int tableResetStatus = 0;

//////////////////////////table tuning
int tableSpeed = 10000;     //table overall speed // previously set to 900
int tableAccel = 5000;    //changed from 1000 to 2000 to get more table speed

int spraySpeed = 10000;  //sprayer overall speed
int sprayAccel = 2000;   //accelleration rate .   //previously set to 10000

//////////////////////////Time based longs and ints
long previousMillis = 0;
long sprayHomeTime = 1000;
long tableHomeTime = 80000;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     SETUP    ///////////////////////////////////////////////////////////////

void setup() {
  
  //Initalize LCD screen
  //first set the LCD's number of colums and rows:
  lcd.begin(16, 2);
  Serial.begin(9600);
  startUpScreen();
  
 //////////////////////////////////////INITALIZE STEPPERS////////////////////////////////////
  sprayer.setAcceleration(sprayAccel);
  sprayer.setMaxSpeed(spraySpeed);
  sprayer.moveTo(1800);     //sets limit on reverse distance 
  

  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
//  table1.moveTo(25000);                /// changed from 50000 to 70000 to see if table will advance
//
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
//  table2.moveTo(45000);

  pinMode (button1, INPUT);

  pinMode (forwardButton, INPUT);
  pinMode (reverseButton, INPUT);
  pinMode (sprayerResetButton, INPUT);
  pinMode (tableResetButton, INPUT);
  
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     LOOP     ///////////////////////////////////////////////////////////////


void loop() {

///////////////////////////   MANUAL CONTROL    ////////////////////////////

  //check status of forward button, if high, advance
  forwardButtonStatus = digitalRead(forwardButton);
  if (forwardButtonStatus == HIGH) {
    table1Advance();
    table2Advance();
    if (advanceHasRun == false){
      advanceScreen();
    }
  }

  //check status of reverse button, if high, reverse
  reverseButtonStatus = digitalRead(reverseButton);
  if (reverseButtonStatus == HIGH) {
    table1Reverse();
    table2Reverse();
    if (reverseHasRun == false){
      reverseScreen();
    } 
  }


///////////////////////////////    RESET    ////////////////////////////////

  tableResetStatus = digitalRead(tableResetButton);
  if (tableResetStatus == HIGH) {
    tableHomeOff = !tableHomeOff; 
    resetScreen();
  }
  while (tableHomeOff == false){
    tableHome();
  }

  ///send the sprayer to the starting position if right set left button is pressed
//  sprayerResetStatus = digitalRead(sprayerResetButton);
//  if (sprayerResetStatus == HIGH) {
//    sprayHomeOff = !sprayHomeOff;
//  }
//  while (sprayHomeOff == false) {
//    sprayHome();
//  } 

////////////////////////    START SEQUENCE    /////////////////////////////////

  button1state = digitalRead(button1);
  if (button1state == HIGH) {
//    tableOff = !tableOff;
//    sprayerOff = !sprayerOff;
      tableOff = false;
      sprayerOff = false;
      laminationScreen();
  }
  while (sprayerOff == false & tableOff == false) {
    spray();
    driveTable();
  }
  
  if (forwardButtonStatus == LOW & reverseButtonStatus == LOW & button1state == LOW & tableResetStatus == LOW){
    idleScreen();

  }
}

//
//   When the two directional buttons are pressed, both tables advance and reverse in sync with eachother 
//

//STATUS: Complete and working properly, but slow due to motor load. 


//advance function, table one
void table1Advance() {
  table1.setSpeed(10000);
  table1.run();
}

//reverse function, table one
void table1Reverse() {
  table1.setSpeed(-10000);
  table1.run();
}

//advance function, table two
void table2Advance() {
  table2.setSpeed(10000);
  table2.run();
}

//reverse function, table two
void table2Reverse() {
  table2.setSpeed(-10000);
  table2.run();
}

//
//
//   When the start button is pressed, the table drive function and the spray function are called. 
//   The sprayer is set with a delay, so that the material advances to the sprayers before the sprayers begin spraying. 
//   Sprayer begin code will be written once the spray guns are mounted. 
//
//   changed spray delay 
//


long sprayTime = 43900;   // changed from 45000 to 30000 to see if table movement distance is affected, it shortened the overall movement by roughly three feet, readjusted to 43000, very close, again to 53900
long tableTime = 80000;   // change from 90000 to 80000 did not affect distance of table movement
long sprayDelay = 7000;   //delay sprayer until table has correctly positioned materials // CHANGED TO 6000 from 7000


/////////////////build out idle state ()
int idleSpeed = 0;
int idleAccel = 0;
int idleDistance = 0;


  
//function that controls sprayer in "start" state
void spray() {
  unsigned long currentSprayMillis = millis();
  if  (currentSprayMillis - previousMillis > sprayDelay) {
    sprayer.setMaxSpeed(spraySpeed);
    sprayer.setAcceleration(sprayAccel);
    sprayer.run();
    //Serial.println("sprayer is running"); //program responded here, motors slowed down immediately
    if (sprayer.distanceToGo() == 0){
      sprayer.moveTo(-sprayer.currentPosition());
      sprayer.run();
      Serial.println(F("sprayer is running")); //program responded here, did not slow motors
    }
    if (currentSprayMillis - previousMillis > sprayTime + sprayDelay) {  //deleted "+ spray delay) from end of perentheses
      sprayerOff = true;
      Serial.println(F("sprayer is off"));
      previousMillis = currentSprayMillis;
    }
  }
}



//function that controls table in "start" state
void driveTable() {
  unsigned long currentTableMillis = millis();
  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  //table1.moveTo(33000); // driver set to 4 microsteps   
  table1.moveTo(20000);   // driver set to 8 microsteps //previously set to 16500
  
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
  //table2.moveTo(48000); // driver set to 4 microsteps
  table2.moveTo(24000);   //driverr set to 8 microsteps // previously 24700
  
  table1.run();
  table2.run();

  if (table1.distanceToGo() == 0 & table2.distanceToGo() == 0){
    idleScreen();
  }
}




//  if (currentTableMillis - previousMillis > tableTime) {
//    Serial.println("tableDrive is off");
//    tableOff = true;
//    sprayerOff = true;
//    idleScreen();
//    previousMillis = currentTableMillis;
//  }




void idleState() {
  sprayer.setMaxSpeed(idleSpeed);
  sprayer.setAcceleration(idleAccel);
  sprayer.moveTo(idleDistance);

  table1.setMaxSpeed(idleSpeed);
  table1.setAcceleration(idleAccel);
  table1.moveTo(idleDistance);               

  table2.setMaxSpeed(idleSpeed);
  table2.setAcceleration(idleAccel);
  table2.moveTo(idleDistance);
  Serial.println("idling");
}


//
//
//sends everything back to starting position, aka RESET
//
//

// homing functions


//spray home runs on pin 50
//table home runs on pin 53

int t2RewindDistance = -24700;
int t1RewindDistance = -28000;         ////////-25900;

void tableHome() {
  unsigned long currentTableResetTime = millis();
  table1.setMaxSpeed(tableSpeed);
  table2.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  table2.setAcceleration(tableAccel);
  table1.moveTo(t2RewindDistance);   //driver set to 8 microsteps // previously set to -24500
  table2.moveTo(t1RewindDistance);   //driverr set to 8 microsteps
  table1.run();
  table2.run();
  if (table1.distanceToGo() == 0){
    idleScreen();
  }
}


void idleScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Ready to proceed"));
}


void startUpScreen(){
  lcd.print(F("SPRAY TABLE V2.0"));
  lcd.setCursor(0, 2);
  lcd.print(F("INITALIZING..."));
  Serial.println(F("Startup complete"));
  delay(500);
  idleScreen();
  Serial.println(F("idling, ready to proceed"));
}


//unsigned long advanceCount;
//int previousAdvanceCount = 0;

void advanceScreen(){
    lcd.print(F("STATUS:      "));
    lcd.setCursor(0, 2);
    lcd.print(F("Advancing       "));
    advanceHasRun = true;
    reverseHasRun = false;
    Serial.println(F("advancing"));
}


void reverseScreen(){
    lcd.clear();
    lcd.print(F("STATUS:        "));
    lcd.setCursor(0, 2);
    lcd.print(F("Reversing       "));
    reverseHasRun = true;
    advanceHasRun = false;
    Serial.println(F("reversing"));
}


void laminationScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0,2);
  lcd.print(F("Laminating       "));
  if (tableOff == true & sprayerOff == true){
    idleScreen();
    Serial.println(F("idling, ready to proceed"));
  }
}


void resetScreen(){
  lcd.clear();
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Table Resetting"));
}

Is this better?

Sketch uses 9954 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 471 bytes (5%) of dynamic memory, leaving 7721 bytes for local variables. Maximum is 8192 bytes.

I added F macros to anything with "print"

I might add that as I have developed this, I have added and deleted things out of the code and left some garbage behind in some areas. I apologize for the confusion that might add.

check recent reply

Post #7 identifies a serious problem.

The compiler gives you a hint that below may not be correct.
Snip

  if (tableOff == true & sprayerOff == true) {
    idleScreen();
  }

Warning

C:\Users\Sterretje\AppData\Local\Temp\arduino_modified_sketch_558599\sketch_may24b.ino:371:16: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]

   if (tableOff == true & sprayerOff == true) {

       ~~~~~~~~~^~~~~~~

There are a few like that. You have to increase the warning level in file -> preferences to ALL.

A single & is a binary AND, a double & is a logical AND.

//function that controls sprayer in "start" state
void spray() {
  unsigned long currentSprayMillis = millis();
  if  (currentSprayMillis - previousMillis > sprayDelay) {
    sprayer.setMaxSpeed(spraySpeed);
    sprayer.setAcceleration(sprayAccel);
    sprayer.run();
    //Serial.println("sprayer is running"); //program responded here, motors slowed down immediately
    if (sprayer.distanceToGo() == 0){
      sprayer.moveTo(-sprayer.currentPosition());
      sprayer.run();
      Serial.println(F("sprayer is running")); //program responded here, did not slow motors
    }
    if (currentSprayMillis - previousMillis > sprayTime + sprayDelay) {  //deleted "+ spray delay) from end of perentheses


      sprayerOff = true;



      Serial.println(F("sprayer is off"));
      previousMillis = currentSprayMillis;
    }
  }
}



//function that controls table in "start" state
void driveTable() {
  unsigned long currentTableMillis = millis();
  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  //table1.moveTo(33000); // driver set to 4 microsteps   
  table1.moveTo(20000);   // driver set to 8 microsteps //previously set to 16500
  
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
  //table2.moveTo(48000); // driver set to 4 microsteps
  table2.moveTo(24000);   //driverr set to 8 microsteps // previously 24700
  
  table1.run();
  table2.run();

  if (table1.distanceToGo() == 0 & table2.distanceToGo() == 0){
    idleScreen();



    tableOff = true;



  }
}

Just added the line that sets tableOff back to true. That solved the issue with tableHome not responding. Now I have the opposite problem, when I go back into "lamination" after I have called tableHome(), the motors just crawl back instead of promptly executing the spray() and driveTable() tasks.

so I need && instead of &?

Yes; it might not solve your problems but that is something else.

1 Like

Far, far clearer to simply use 'and' instead of '&&', if you get confused.

1 Like

So the program will now allow for "tableHome" after calling the lamination functions "spray() and driveTable()" but now it will not properly execute the distance parameter when the lamination functions are called again. The machine is also unresponsive after toggling one or both of the manual control buttons (advance or reverse) Is it possible to have this work with any reliability without pressing the arduino's reset button?



#include <AccelStepper.h>
#include <LiquidCrystal.h>
#include <StateMachine.h> 

//LCD Screen Setup
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
unsigned int lcdStatus;
bool advanceHasRun = false;
int reverseHasRun = false;
int idleingHasRun = false;

//motor decleration
AccelStepper sprayer(1, 35, 33); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5 .   ////37 now 33, 39 now 35
AccelStepper table1(1, 43, 41);  // 1, pulse pin, direction pin
AccelStepper table2(1, 47, 45);  // 1, pulse pin, direction pin

//const int motorEnable = 10;

/////////////////////////start button
int button1 = 52;
int button1state = 0;

/////////////////////////boolean switches
bool sprayerOff = true;
bool tableOff = true;
bool tableHomeOff = true;
bool sprayHomeOff = true;

/////////////////////////table1 manual control
//forwardButton = t1f = 49
//reverseButton = t1r = 51
int forwardButton = 49;
int reverseButton = 51;
//t1fstate = forwardButtonStatus = 0
//t1rstate = reverseButtonStatus = 0
int forwardButtonStatus = 0;
int reverseButtonStatus = 0;

/////////////////////////reset buttons
// this is becoming home buttons, and has been renamed. old variable names are slashed out

//t2f = sprayerResetButton = 50
//t2r = tableResetButton = 53
int sprayerResetButton = 50;
int tableResetButton = 53;
//t2fState = sprayerResetStatus = 0
//t2rState = tableResetStatus = 0
int sprayerResetStatus = 0;
int tableResetStatus = 0;

//////////////////////////table tuning
int tableSpeed = 10000;     //table overall speed // previously set to 900
int tableAccel = 5000;    //changed from 1000 to 2000 to get more table speed

int spraySpeed = 10000;  //sprayer overall speed
int sprayAccel = 2000;   //accelleration rate .   //previously set to 10000

//////////////////////////Time based longs and ints
long previousMillis = 0;
long sprayHomeTime = 1000;
long tableHomeTime = 80000;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     SETUP    ///////////////////////////////////////////////////////////////

void setup() {
  
  //Initalize LCD screen
  //first set the LCD's number of colums and rows:
  lcd.begin(16, 2);
  Serial.begin(9600);
  startUpScreen();
  
 //////////////////////////////////////INITALIZE STEPPERS////////////////////////////////////
  sprayer.setAcceleration(sprayAccel);
  sprayer.setMaxSpeed(spraySpeed);
  sprayer.moveTo(1800);     //sets limit on reverse distance 
  

  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
//  table1.moveTo(25000);                /// changed from 50000 to 70000 to see if table will advance
//
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
//  table2.moveTo(45000);

  pinMode (button1, INPUT);

  pinMode (forwardButton, INPUT);
  pinMode (reverseButton, INPUT);
  pinMode (sprayerResetButton, INPUT);
  pinMode (tableResetButton, INPUT);
  
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     LOOP     ///////////////////////////////////////////////////////////////


void loop() {

///////////////////////////   MANUAL CONTROL    ////////////////////////////

  //check status of forward button, if high, advance
  forwardButtonStatus = digitalRead(forwardButton);
  if (forwardButtonStatus == HIGH) {
    table1Advance();
    table2Advance();
    if (advanceHasRun == false){
      advanceScreen();
    }
  }

  //check status of reverse button, if high, reverse
  reverseButtonStatus = digitalRead(reverseButton);
  if (reverseButtonStatus == HIGH) {
    table1Reverse();
    table2Reverse();
    if (reverseHasRun == false){
      reverseScreen();
    } 
  }


///////////////////////////////    RESET    ////////////////////////////////

  tableResetStatus = digitalRead(tableResetButton);
  if (tableResetStatus == HIGH) {
    tableHomeOff = !tableHomeOff; 
    resetScreen();
  }
  while (tableHomeOff == false){
    tableHome();
  }

  ///send the sprayer to the starting position if right set left button is pressed
//  sprayerResetStatus = digitalRead(sprayerResetButton);
//  if (sprayerResetStatus == HIGH) {
//    sprayHomeOff = !sprayHomeOff;
//  }
//  while (sprayHomeOff == false) {
//    sprayHome();
//  } 

////////////////////////    START SEQUENCE    /////////////////////////////////

  button1state = digitalRead(button1);
  if (button1state == HIGH) {
//    tableOff = !tableOff;
//    sprayerOff = !sprayerOff;
      tableOff = false;
      sprayerOff = false;
      laminationScreen();
  }
  while (sprayerOff == false and tableOff == false) {
    spray();
    driveTable();
  }
  
  if (forwardButtonStatus == LOW and reverseButtonStatus == LOW and button1state == LOW and tableResetStatus == LOW){
    idleScreen();
  }
}

//
//   When the two directional buttons are pressed, both tables advance and reverse in sync with eachother 
//

//STATUS: Complete and working properly, but slow due to motor load. 


//advance function, table one
void table1Advance() {
  table1.setSpeed(10000);
  table1.run();
}

//reverse function, table one
void table1Reverse() {
  table1.setSpeed(-10000);
  table1.run();
}

//advance function, table two
void table2Advance() {
  table2.setSpeed(10000);
  table2.run();
}

//reverse function, table two
void table2Reverse() {
  table2.setSpeed(-10000);
  table2.run();
}


//
//
//   When the start button is pressed, the table drive function and the spray function are called. 
//   The sprayer is set with a delay, so that the material advances to the sprayers before the sprayers begin spraying. 
//   Sprayer begin code will be written once the spray guns are mounted. 
//
//   changed spray delay 
//


long sprayTime = 43900;   // changed from 45000 to 30000 to see if table movement distance is affected, it shortened the overall movement by roughly three feet, readjusted to 43000, very close, again to 53900
long tableTime = 80000;   // change from 90000 to 80000 did not affect distance of table movement
long sprayDelay = 4000;   //delay sprayer until table has correctly positioned materials // CHANGED TO 6000 from 7000


/////////////////build out idle state ()
int idleSpeed = 0;
int idleAccel = 0;
int idleDistance = 0;


  
//function that controls sprayer in "start" state
void spray() {
  unsigned long currentSprayMillis = millis();
  if  (currentSprayMillis - previousMillis > sprayDelay) {
    sprayer.setMaxSpeed(spraySpeed);
    sprayer.setAcceleration(sprayAccel);
    sprayer.run();
    //Serial.println("sprayer is running"); //program responded here, motors slowed down immediately
    if (sprayer.distanceToGo() == 0){
      sprayer.moveTo(-sprayer.currentPosition());
      sprayer.run();
      Serial.println(F("sprayer is running")); //program responded here, did not slow motors
    }
    if (currentSprayMillis - previousMillis > sprayTime + sprayDelay) {  //deleted "+ spray delay) from end of perentheses
      sprayerOff = true;
      Serial.println(F("sprayer is off"));
      Serial.println(F("Lamination Complete"));
      previousMillis = currentSprayMillis;
    }
  }
}



//function that controls table in "start" state
void driveTable() {
  unsigned long currentTableMillis = millis();
  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  //table1.moveTo(33000); // driver set to 4 microsteps   
  table1.moveTo(20000);   // driver set to 8 microsteps //previously set to 16500
  
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
  //table2.moveTo(48000); // driver set to 4 microsteps
  table2.moveTo(27000);   //driverr set to 8 microsteps // previously 24700
  
  table1.run();
  table2.run();

  if (table1.distanceToGo() == 0 and table2.distanceToGo() == 0){
    idleScreen();
    tableOff = true;
  }
}


// homing functions


//spray home runs on pin 50
//table home runs on pin 53

int t2RewindDistance = -7200;
int t1RewindDistance = -8200;         ////////-25900;

void tableHome() {
  //unsigned long currentTableResetTime = millis();
  table1.setMaxSpeed(tableSpeed);
  table2.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  table2.setAcceleration(tableAccel);
  table1.moveTo(t2RewindDistance);   //driver set to 8 microsteps // previously set to -24500
  table2.moveTo(t1RewindDistance);   //driverr set to 8 microsteps
  table1.run();
  table2.run();
  if (table1.distanceToGo() == 0){
    Serial.println(F("reset complete, material is now in its starting position"));
    tableHomeOff = true;
  } while (tableHomeOff == true){
    pleaseRebootScreen();
  }
}




void idleScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Ready to proceed"));
}

void pleaseRebootScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Press Reboot!   "));
}

void startUpScreen(){
  lcd.print(F("SPRAY TABLE V2.0"));
  lcd.setCursor(0, 2);
  lcd.print(F("INITALIZING..."));
  Serial.println(F("Startup complete"));
  delay(500);
  idleScreen();
  Serial.println(F("Idling, ready to proceed"));
}


//unsigned long advanceCount;
//int previousAdvanceCount = 0;

void advanceScreen(){
    lcd.print(F("STATUS:      "));
    lcd.setCursor(0, 2);
    lcd.print(F("Advancing       "));
    advanceHasRun = true;
    reverseHasRun = false;
    Serial.println(F("advancing"));
}


void reverseScreen(){
    lcd.clear();
    lcd.print(F("STATUS:        "));
    lcd.setCursor(0, 2);
    lcd.print(F("Reversing       "));
    reverseHasRun = true;
    advanceHasRun = false;
    Serial.println(F("reversing"));
}


void laminationScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0,2);
  lcd.print(F("Laminating       "));
  Serial.println(F("Laminating"));
}


void resetScreen(){
  lcd.clear();
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Table Resetting"));
  Serial.println(F("Table resetting"));
}

@wildbill

Please get into the habit of posting your latest code when you have another question.

It appears that the sprayer gets an initial position in setup and the spray function will take it there one step at a time if the sprayTime is long enough. Then it sets it to move to -sprayer.currentPosition().

On the next pair of boards, if the stepper made it to -sprayer.currentPosition(), it now has no instruction to go anywhere, so any call to spray will not move it. Somewhere, you need to give it a destination.

Edit: Maybe not. It's possible that the -sprayer.currentPosition() will flip it again between 1800 and -1800. If so, I'm not sure what's breaking it.

Right @wildbill ! The oscillation between 1800 & -1800 is to make the sprayer sweep back and forth. The sprayer is currently doing nothing, and I'm assuming that has more to do with the very cheap Chinese knockoff drivers I am currently running (swapping with Gecko G203V drives next week once I have a PCB to assemble) than the program. I could be wrong, but when I have switched to a blank sketch and simply written the driver to high and low with a very small delay between (hello world functionality) nothing is happening.

I'm also trying to get the laminate function to work after one of the directional buttons are pressed. I tried adding a boolean, but there was no change. At the moment, the motor just barely crawls in the direction of the last manual control button press when lamination functions are called.

#include <AccelStepper.h>
#include <LiquidCrystal.h>
#include <StateMachine.h> 

//LCD Screen Setup
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
unsigned int lcdStatus;
bool advanceHasRun = false;
int reverseHasRun = false;
int idleingHasRun = false;

//motor decleration
AccelStepper sprayer(1, 35, 33); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5 .   ////37 now 33, 39 now 35
AccelStepper table1(1, 43, 41);  // 1, pulse pin, direction pin
AccelStepper table2(1, 47, 45);  // 1, pulse pin, direction pin

/////////////////////////start button
int laminateButton = 52;
int laminateButtonstate = 0;

/////////////////////////boolean switches
bool sprayerOff = true;
bool tableOff = true;
bool tableHomeOff = true;
bool sprayHomeOff = true;
bool advance = false;
bool reverse = false;

/////////////////////////table1 manual control
int forwardButton = 49;
int reverseButton = 51;

int forwardButtonStatus = 0;
int reverseButtonStatus = 0;

/////////////////////////reset buttons
int sprayerResetButton = 50;
int tableResetButton = 53;

int sprayerResetStatus = 0;
int tableResetStatus = 0;

//////////////////////////table tuning
int tableSpeed = 10000;     //table overall speed // previously set to 900
int tableAccel = 5000;    //changed from 1000 to 5000 to get more table speed

int spraySpeed = 10000;  //sprayer overall speed
int sprayAccel = 2000;   //accelleration rate .   //previously set to 10000

//////////////////////////Time based longs and ints
long previousMillis = 0;
long sprayHomeTime = 1000;
long tableHomeTime = 80000;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     SETUP    ///////////////////////////////////////////////////////////////

void setup() {
  
  //Initalize LCD screen
  //first set the LCD's number of colums and rows:
  lcd.begin(16, 2);
  Serial.begin(9600);
  startUpScreen();
  
 //////////////////////////////////////INITALIZE STEPPERS////////////////////////////////////
  sprayer.setAcceleration(sprayAccel);
  sprayer.setMaxSpeed(spraySpeed);
  sprayer.moveTo(1800);     //sets limit on reverse distance 
  

  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);

  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);

  pinMode (laminateButton, INPUT);
  pinMode (forwardButton, INPUT);
  pinMode (reverseButton, INPUT);
  pinMode (sprayerResetButton, INPUT);
  pinMode (tableResetButton, INPUT);
  
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////     LOOP     ///////////////////////////////////////////////////////////////


void loop() {

///////////////////////////   MANUAL CONTROL    ////////////////////////////

  //check status of forward button, if high, advance
  forwardButtonStatus = digitalRead(forwardButton);
  if (forwardButtonStatus == HIGH) {
    advance = true;
    while (advance == true){
      table1Advance();
      table2Advance();
      if (advanceHasRun == false){
        advanceScreen();
      }
    } 
  }

  //check status of reverse button, if high, reverse
  reverseButtonStatus = digitalRead(reverseButton);
  if (reverseButtonStatus == HIGH) {
    reverse = true;
    while (reverse == true){
      table1Reverse();
      table2Reverse();
      if (reverseHasRun == false){
         reverseScreen();
      } 
    }
  }


///////////////////////////////    RESET    ////////////////////////////////

  tableResetStatus = digitalRead(tableResetButton);
  if (tableResetStatus == HIGH) {
    tableHomeOff = !tableHomeOff; 
    resetScreen();
  }
  while (tableHomeOff == false){
    tableHome();
  }

  //send the sprayer to the starting position if right left button is pressed
  sprayerResetStatus = digitalRead(sprayerResetButton);
  if (sprayerResetStatus == HIGH) {
    sprayHomeOff = !sprayHomeOff;
  }
  while (sprayHomeOff == false) {
    sprayHome();
  } 

////////////////////////    START SEQUENCE    /////////////////////////////////

  laminateButtonstate = digitalRead(laminateButton);
  if (laminateButtonstate == HIGH) {
      tableOff = false;
      sprayerOff = false;
      laminationScreen();
  }
  while (sprayerOff == false and tableOff == false) {
    spray();
    driveTable();
  }
  
  if (forwardButtonStatus == LOW and reverseButtonStatus == LOW and laminateButtonstate == LOW and tableResetStatus == LOW){
    idleScreen();
  }
}

//advance function, table one
void table1Advance() {
  table1.setSpeed(10000);
  table1.run();
  advance = false;
}

//reverse function, table one
void table1Reverse() {
  table1.setSpeed(-10000);
  table1.run();
  reverse = false;
}

//advance function, table two
void table2Advance() {
  table2.setSpeed(10000);
  table2.run();
}

//reverse function, table two
void table2Reverse() {
  table2.setSpeed(-10000);
  table2.run();
}


int t2RewindDistance = -7200;
int t1RewindDistance = -8200;         ////////-25900;

int sprayHomeDistance = -500;

void tableHome() {
  //unsigned long currentTableResetTime = millis();
  table1.setMaxSpeed(tableSpeed);
  table2.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  table2.setAcceleration(tableAccel);
  table1.moveTo(t2RewindDistance);   //driver set to 8 microsteps // previously set to -24500
  table2.moveTo(t1RewindDistance);   //driverr set to 8 microsteps
  table1.run();
  table2.run();
  if (table1.distanceToGo() == 0){
    Serial.println(F("reset complete, material is now in its starting position"));
    tableHomeOff = true;
  } while (tableHomeOff == true){
    pleaseRebootScreen();
  }
}

void sprayHome(){
  sprayer.setMaxSpeed(spraySpeed);
  sprayer.moveTo(sprayHomeDistance);
  sprayer.run();
  Serial.println(F("sprayReset is working"));
}


long sprayTime = 43900;   // changed from 45000 to 30000 to see if table movement distance is affected, it shortened the overall movement by roughly three feet, readjusted to 43000, very close, again to 53900
long tableTime = 80000;   // change from 90000 to 80000 did not affect distance of table movement
long sprayDelay = 4000;   //delay sprayer until table has correctly positioned materials // CHANGED TO 6000 from 7000


/////////////////build out idle state ()
int idleSpeed = 0;
int idleAccel = 0;
int idleDistance = 0;


  
//function that controls sprayer in "start" state
void spray() {
  unsigned long currentSprayMillis = millis();
  if  (currentSprayMillis - previousMillis > sprayDelay) {
    sprayer.setMaxSpeed(spraySpeed);
    sprayer.setAcceleration(sprayAccel);
    sprayer.run();
    //Serial.println("sprayer is running"); //program responded here, motors slowed down immediately
    if (sprayer.distanceToGo() == 0){
      sprayer.moveTo(-sprayer.currentPosition());
      sprayer.run();
      Serial.println(F("sprayer is running")); //program responded here, did not slow motors
    }
    if (currentSprayMillis - previousMillis > sprayTime + sprayDelay) {  //deleted "+ spray delay) from end of perentheses
      sprayerOff = true;
      Serial.println(F("sprayer is off"));
      Serial.println(F("Lamination Complete"));
      previousMillis = currentSprayMillis;
    }
  }
}



//function that controls table in "start" state
void driveTable() {
  unsigned long currentTableMillis = millis();
  table1.setMaxSpeed(tableSpeed);
  table1.setAcceleration(tableAccel);
  //table1.moveTo(33000); // driver set to 4 microsteps   
  table1.moveTo(20000);   // driver set to 8 microsteps //previously set to 16500
  
  table2.setMaxSpeed(tableSpeed);
  table2.setAcceleration(tableAccel);
  //table2.moveTo(48000); // driver set to 4 microsteps
  table2.moveTo(27000);   //driverr set to 8 microsteps // previously 24700
  
  table1.run();
  table2.run();

  if (table1.distanceToGo() == 0 and table2.distanceToGo() == 0){
    idleScreen();
    tableOff = true;
  }
}

void idleScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Ready to proceed"));
}

void pleaseRebootScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Press Reboot!   "));
}

void startUpScreen(){
  lcd.print(F("SPRAY TABLE V2.0"));
  lcd.setCursor(0, 2);
  lcd.print(F("INITALIZING..."));
  Serial.println(F("Startup complete"));
  delay(500);
  idleScreen();
  Serial.println(F("Idling, ready to proceed"));
}

void advanceScreen(){
    lcd.print(F("STATUS:      "));
    lcd.setCursor(0, 2);
    lcd.print(F("Advancing       "));
    advanceHasRun = true;
    reverseHasRun = false;
    Serial.println(F("advancing"));
}

void reverseScreen(){
    lcd.clear();
    lcd.print(F("STATUS:        "));
    lcd.setCursor(0, 2);
    lcd.print(F("Reversing       "));
    reverseHasRun = true;
    advanceHasRun = false;
    Serial.println(F("reversing"));
}

void laminationScreen(){
  lcd.print(F("Status:"));
  lcd.setCursor(0,2);
  lcd.print(F("Laminating       "));
  Serial.println(F("Laminating"));
}

void resetScreen(){
  lcd.clear();
  lcd.print(F("Status:"));
  lcd.setCursor(0, 2);
  lcd.print(F("Table Resetting"));
  Serial.println(F("Table resetting"));
}

Any ideas for this or post#16 @UKHeliBob ?

/Users/lewisdenver/Desktop/SPRAY TABLE/freshOS/C_Laminate.ino: In function 'void spray()':
/Users/lewisdenver/Desktop/SPRAY TABLE/freshOS/C_Laminate.ino:17:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if  (currentSprayMillis - previousMillis > sprayDelay) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/Users/lewisdenver/Desktop/SPRAY TABLE/freshOS/C_Laminate.ino:27:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (currentSprayMillis - previousMillis > sprayTime + sprayDelay) {  //deleted "+ spray delay) from end of perentheses
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/Users/lewisdenver/Desktop/SPRAY TABLE/freshOS/C_Laminate.ino: In function 'void driveTable()':
/Users/lewisdenver/Desktop/SPRAY TABLE/freshOS/C_Laminate.ino:40:17: warning: unused variable 'currentTableMillis' [-Wunused-variable]
   unsigned long currentTableMillis = millis();
                 ^~~~~~~~~~~~~~~~~~
Sketch uses 10234 bytes (4%) of program storage space. Maximum is 253952 bytes.
Global variables use 475 bytes (5%) of dynamic memory, leaving 7717 bytes for local variables. Maximum is 8192 bytes.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.