Simple stepper control using Bourns rotary encoder & LCD

Hello, I have an issue with a sketch made for operating a stepper motor with a Bourns rotary encoder and an LCD to display position and I have received this error:

no matching function for call to 'ACE128::ACE128(int, int, int, int, int, int, int, int, uint8_t*)'

I know this is probably and easy fix but I just can't seem to get my head around it. I've tried to reach the original author but have received no com. Keep in mind that I am a new coder and would like as much info about this that anyone will give. I have spent a few hours reading forums, searching the web and just looking for code that is similar that might help.

Thank you.

Here is the code:

#include <LiquidCrystal_I2C.h> // I2C LCD Library by Francisco Malpartida https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
#include <AccelStepper.h> // AccelStepper Library AccelStepper - Arduino Libraries

#define I2C_ADDR 0x27 // I2C address of typical I2C LCD Backpack

// LCD Pins to I2C LCD Backpack - These are default for HD44780 LCD's
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

// Create instance for LCD called: i2c_lcd
LiquidCrystal_I2C i2c_lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

const int pinSTEP=11; // STEP pin of EasyDriver connected to pin 11 of UNO
const int pinDIR=10; // DIR pin of EasyDriver connected to pin 10 of UNO

AccelStepper stepper(1, pinSTEP, pinDIR); // Stepper setup

// Include the Bourns EAW Encoder library and maps
#include <ACE128.h> // GitHub - arielnh56/ACE128: Arduino library for Bourns 128 position Absolute Contacting Encoder

#include <ACE128map12345678.h> // mapping for pin order 12345678

// Pin x of UNO connected to pin x of Encoder (example: UNO pin 2 connected to pin 1 of encoder, etc...)
ACE128 myACE(2,3,4,5,6,7,8,9, (uint8_t*)encoderMap_12345678);

int16_t multiturn_encoder_value; // Variable to hold multiturn value of encoder (-32768 to 32767)

void setup() {
i2c_lcd.begin (16,2); // our LCD is a 16x2, change for your LCD if needed

// LCD Backlight ON
i2c_lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
i2c_lcd.setBacklight(HIGH);

i2c_lcd.clear(); // Clear the LCD screen

stepper.setCurrentPosition(0); // Set current position of stepper at startup to zero
stepper.setMaxSpeed(1000.0); // Set Max Speed of stepper
stepper.setAcceleration(5000.0); // Acceleration of stepper
stepper.setSpeed(1000.0); // Speed of stepper

myACE.begin(); // initialize the encoder library
}

void loop() {

multiturn_encoder_value = myACE.mpos(); // get multiturn value from encoder
stepper.moveTo(multiturn_encoder_value); // set stepper new position to move to

while (stepper.distanceToGo() != 0) { // if stepper hasn't reached new position
stepper.runSpeedToPosition(); // move the stepper until new position reached
}

// Display the encoder multiturn and stepper position on LCD
i2c_lcd.setCursor(0,0);
i2c_lcd.print("Encoder: ");
i2c_lcd.setCursor(9,0);
i2c_lcd.print(multiturn_encoder_value);
i2c_lcd.print(" ");
i2c_lcd.setCursor(0,1);
i2c_lcd.print("Stepper: ");
i2c_lcd.setCursor(9,1);
i2c_lcd.print(stepper.currentPosition());
i2c_lcd.print(" ");
}

The constructor takes a different number of parameters depending if EEPROM_NONE is defined. It seems like you do not have that, because in that case, it requires an EEPROM address on the end of the constructor parameters.

You could probably edit your copy of the .h file in the library to fix this.

Next time you post code, please use code tags.

Any change you can explain how to resolve this for a newby? ive got the same errors, never used arduino before so i've no idea what has to be done to resolve it

In the library, there is an option to either use the EEPROM or not use it. You have selected the wrong option for the code you are trying to use.

Which way do you want to go? Use EEPROM or not use it?

MorganS:
In the library, there is an option to either use the EEPROM or not use it. You have selected the wrong option for the code you are trying to use.

Which way do you want to go? Use EEPROM or not use it?

God i feel stupid lol, i don't even know what eeprom is, i just wanted to copy the build and install the stuff as expained in the tutorial,

this is the code im using

/* Control Stepper Motor with 'Bourns EAW' encoder

Created by Yvan / https://Brainy-Bits.com

This code is in the public domain...

You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!
*/

#include <LiquidCrystal_I2C.h> // I2C LCD Library by Francisco Malpartida https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
#include <AccelStepper.h> // AccelStepper Library AccelStepper - Arduino Libraries

#define I2C_ADDR 0x27 // I2C address of typical I2C LCD Backpack

// LCD Pins to I2C LCD Backpack - These are default for HD44780 LCD's
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

// Create instance for LCD called: i2c_lcd
LiquidCrystal_I2C i2c_lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

const int pinSTEP=11; // STEP pin of EasyDriver connected to pin 11 of UNO
const int pinDIR=10; // DIR pin of EasyDriver connected to pin 10 of UNO

AccelStepper stepper(1, pinSTEP, pinDIR); // Stepper setup

// Include the Bourns EAW Encoder library and maps
#include <ACE128.h> // GitHub - arielnh56/ACE128: Arduino library for Bourns 128 position Absolute Contacting Encoder

#include <ACE128map12345678.h> // mapping for pin order 12345678

// Pin x of UNO connected to pin x of Encoder (example: UNO pin 2 connected to pin 1 of encoder, etc...)
ACE128 myACE(2,3,4,5,6,7,8,9, (uint8_t*)encoderMap_12345678);

int16_t multiturn_encoder_value; // Variable to hold multiturn value of encoder (-32768 to 32767)

void setup() {
i2c_lcd.begin (16,2); // our LCD is a 16x2, change for your LCD if needed

// LCD Backlight ON
i2c_lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
i2c_lcd.setBacklight(HIGH);

i2c_lcd.clear(); // Clear the LCD screen

stepper.setCurrentPosition(0); // Set current position of stepper at startup to zero
stepper.setMaxSpeed(1000.0); // Set Max Speed of stepper
stepper.setAcceleration(5000.0); // Acceleration of stepper
stepper.setSpeed(1000.0); // Speed of stepper

myACE.begin(); // initialize the encoder library
}

void loop() {

multiturn_encoder_value = myACE.mpos(); // get multiturn value from encoder
stepper.moveTo(multiturn_encoder_value); // set stepper new position to move to

while (stepper.distanceToGo() != 0) { // if stepper hasn't reached new position
stepper.runSpeedToPosition(); // move the stepper until new position reached
}

// Display the encoder multiturn and stepper position on LCD
i2c_lcd.setCursor(0,0);
i2c_lcd.print("Encoder: ");
i2c_lcd.setCursor(9,0);
i2c_lcd.print(multiturn_encoder_value);
i2c_lcd.print(" ");
i2c_lcd.setCursor(0,1);
i2c_lcd.print("Stepper: ");
i2c_lcd.setCursor(9,1);
i2c_lcd.print(stepper.currentPosition());
i2c_lcd.print(" ");
}

this line is highlighted

"// Pin x of UNO connected to pin x of Encoder (example: UNO pin 2 connected to pin 1 of encoder, etc...)
ACE128 myACE(2,3,4,5,6,7,8,9, (uint8_t*)encoderMap_12345678);
"

and this is the error

"Arduino: 1.8.10 (Mac OS X), Board: "Arduino/Genuino Uno"

sketch_nov15a:43:60: error: no matching function for call to 'ACE128::ACE128(int, int, int, int, int, int, int, int, uint8_t*)'
ACE128 myACE(2,3,4,5,6,7,8,9, (uint8_t*)encoderMap_12345678);
^
In file included from /Users/garytaylor/Documents/Arduino/sketch_nov15a/sketch_nov15a.ino:38:0:
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:187:1: note: candidate: ACE128::ACE128(uint8_t, uint8_t*)
ACE128::ACE128(uint8_t i2caddr, uint8_t map) : ACE128::ACE128(i2caddr, map, -1) {}
^~~~~~
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:187:1: note: candidate expects 2 arguments, 9 provided
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:188:1: note: candidate: ACE128::ACE128(uint8_t, uint8_t
, int16_t)
ACE128::ACE128(uint8_t i2caddr, uint8_t map, int16_t eeAddr)
^~~~~~
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:188:1: note: candidate expects 3 arguments, 9 provided
In file included from /Users/garytaylor/Documents/Arduino/sketch_nov15a/sketch_nov15a.ino:38:0:
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:75:7: note: candidate: constexpr ACE128::ACE128(const ACE128&)
class ACE128
^~~~~~
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:75:7: note: candidate expects 1 argument, 9 provided
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:75:7: note: candidate: constexpr ACE128::ACE128(ACE128&&)
/Users/garytaylor/Documents/Arduino/libraries/ACE128-master/src/ACE128.h:75:7: note: candidate expects 1 argument, 9 provided
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: /Users/garytaylor/Documents/Arduino/libraries/NewLiquidCrystal_lib
Multiple libraries were found for "AccelStepper.h"
Used: /Users/garytaylor/Documents/Arduino/libraries/AccelStepper-1.59.0
Multiple libraries were found for "ACE128.h"
Used: /Users/garytaylor/Documents/Arduino/libraries/ACE128-master
Multiple libraries were found for "Wire.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
Multiple libraries were found for "EEPROM.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/EEPROM
exit status 1
no matching function for call to 'ACE128::ACE128(int, int, int, int, int, int, int, int, uint8_t
)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"

really appreciate the help by the way

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Hi tom, no worries

Which tutorial? Show a link to the page you're reading.

Hi all,
Sorry that I haven't been back to reply to this in a long while. Too busy. I know aren't we all. I'm not even sure that I inserted this link correctly so if doesn't work let me know and I will try again.

After reviewing the library on GitHub and the error message more closely, it seems like you need to edit a line in the library's .h file to enable the "Arduino Pins" option. Find the line below in the .h file and remove the "//" at the beginning of the line...

// #define ACE128_ARDUINO_PINS

Note that the compiler says it found multiple versions of the library, so you should edit this one...

Multiple libraries were found for "ACE128.h"
Used: /Users/garytaylor/Documents/Arduino/libraries/ACE128-master