I put the LCD initializing function back in (without the status) and the code now compiles. If you look at the HelloWorld.ino example, it shows how the status variable is used and what it means.
#include <Wire.h>
#include <AccelStepper.h>
#include <hd44780.h> // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip
const int LCD_COLS = 16;
const int LCD_ROWS = 2;
// Define the stepper and the pins it will use
AccelStepper stepper1(AccelStepper::DRIVER, 8, 9); //8=PUL, 9=DIR "AccelStepper::DRIVER" cam be changed to "1" ok
// Define our three input button pins
#define LEFT_PIN 5
#define STOP_PIN 4
#define RIGHT_PIN 3
#define ENA 7 //So the stepper will turn freely when STOP is pressed.
// Define our analog pot input pin
#define SPEED_PIN A0
// Define our maximum and minimum speed in steps per second (scale pot to these)
#define MAX_SPEED 5000 //this was set to 500, but I changed to higher number, might set higher later
#define MIN_SPEED 0.0 //This was set to 0.1, but I changed to 0 so rotation would stop at min setting
float current_speed = 0.0; // Holds current motor speed in steps/second
int analog_read_counter = 1000; // Counts down to 0 to fire analog read
char sign = 0; // Holds -1, 1 or 0 to turn the motor on/off and control direction
int analog_value = 0; // Holds raw analog value.
int rpm = 0;
float ips = 0.0;
int timer = 0;
void setup()
{
// The only AccelStepper value we have to set here is the max speeed, which is higher than we'll ever go
stepper1.setMaxSpeed(10000.0);
// initialize serial communications at 9600 bps:
Serial.begin(9600);
// initialize and home the LCD display
lcd.begin(LCD_COLS, LCD_ROWS);
// Set up the three button inputs, with pullups
pinMode(LEFT_PIN, INPUT_PULLUP);
pinMode(STOP_PIN, INPUT_PULLUP);
pinMode(RIGHT_PIN, INPUT_PULLUP);
pinMode (ENA, OUTPUT);
}
void loop()
{
// If a switch is pushed down (low), set the sign value appropriately
if (digitalRead(LEFT_PIN) == 0)
{
sign = 1; digitalWrite(ENA, HIGH);
}
else if (digitalRead(RIGHT_PIN) == 0)
{
sign = -1; digitalWrite(ENA, HIGH);
}
else if (digitalRead(STOP_PIN) == 0)
{
sign = 0; digitalWrite(ENA, LOW);
}
stepper1.runSpeed(); // This will run the stepper at a constant speed
// We only want to read the pot every so often (because it takes a long time we don't
// want to do it every time through the main loop).
if (analog_read_counter > 0)
{
analog_read_counter--;
}
else
{
analog_read_counter = 3000; //originally at 3000
// Now read the pot (from 0 to 1023)
analog_value = analogRead(SPEED_PIN);
// Give the stepper a chance to step if it needs to
stepper1.runSpeed(); // ******** should not need this.
// And scale the pot's value from min to max speeds
current_speed = sign * (((analog_value / 1023.0) * (MAX_SPEED - MIN_SPEED)) + MIN_SPEED);
}
// Update the stepper to run at this new speed
stepper1.setSpeed(current_speed);
rpm = (analog_value / 5.5297);
ips = (analog_value / 56.8333);
updateDisplay();
}
void updateDisplay()
{
static unsigned long timer = 0;
unsigned long interval = 500; // update display 2 times / second
if (millis() - timer >= interval)
{
timer = millis();
lcd.setCursor(2, 0); // set the LCD cursor position
lcd.print("RPM = ");
lcd.setCursor(8, 0);
lcd.print(" "); // overwrite old data
lcd.setCursor(8, 0); // reset cursor
lcd.print(rpm);
lcd.setCursor(2, 1); // set the LCD cursor position
lcd.print("IPM = ");
lcd.setCursor(8, 1);
lcd.print(" "); // overwrite old data
lcd.setCursor(8, 1); // reset cursor
lcd.print(ips, 1);
}
}