Hello,
I have built a FLexscope on top of a Raspberry Pi, and I am now sorting out software issues. I do get an image in the Open Flexure app, but I have not yet been able to compile and upload the Arduino sketch to the nano (ATmega328p) that should drive the 3 stepper boards. Thus, no moving stage.
I am using the Arduino 1.8.13 IDE, the six month old arduino_code_sangaboard_sangaboard sketch from the Bath Open Instrumentation Gitlab site, and the StepperF_alt.h document. The error I get includes the following: ‘‘void Stepper::stepMotor(int)’ is private within this context’. I’ll c/p the full error message, .h document, and sangaboard sketch below. (edit: I removed the sangaboard sketch)
So far I have been able to shoot all problems that arose during building, but this is over my head. Any help would be appreciated!
Thank you, best regards, Jan-Maarten
Error message:
Arduino: 1.8.13 (Linux), Board: “Arduino Nano, ATmega328P”
motors[motor]->stepMotor(((current_pos[motor] % 8) + 8) % 8); //forgive the double-modulo; I need 0-7 even for -ve numbers
^
In file included from /home/pi/Downloads/arduino_code_sangaboard_sangaboard/arduino_code_sangaboard_sangaboard.ino:17:0:
/tmp/arduino_build_769587/sketch/StepperF_alt.h:103:10: note: declared private here
void stepMotor(int this_step);
^~~~~~~~~
/home/pi/Downloads/arduino_code_sangaboard_sangaboard/arduino_code_sangaboard_sangaboard.ino: In function ‘void releaseMotor(int)’:
arduino_code_sangaboard_sangaboard:187:29: error: ‘void Stepper::stepMotor(int)’ is private within this context
motors[motor]->stepMotor(8);
^
In file included from /home/pi/Downloads/arduino_code_sangaboard_sangaboard/arduino_code_sangaboard_sangaboard.ino:17:0:
/tmp/arduino_build_769587/sketch/StepperF_alt.h:103:10: note: declared private here
void stepMotor(int this_step);
^~~~~~~~~
Using library EEPROM at version 2.0 in folder: /tmp/arduino-1.8.13/hardware/arduino/avr/libraries/EEPROM
exit status 1
‘void Stepper::stepMotor(int)’ is private within this context
The .h file:
/*
- Stepper.h - Stepper library for Wiring/Arduino - Version 1.1.0
- Original library (0.1) by Tom Igoe.
- Two-wire modifications (0.2) by Sebastian Gassner
- Combination version (0.3) by Tom Igoe and David Mellis
- Bug fix for four-wire (0.4) by Tom Igoe, bug fix from Noah Shibley
- High-speed stepping mod by Eugene Kozlenko
- Timer rollover fix by Eugene Kozlenko
- Five phase five wire (1.1.0) by Ryan Orendorff
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// ensure this library description is only included once
#ifndef Stepper_h
#define Stepper_h
// library interface description
class Stepper {
public:
// constructors:
// Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2);
Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
int motor_pin_3, int motor_pin_4);
// Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
// int motor_pin_3, int motor_pin_4,
// int motor_pin_5);
// speed setter method:
void setSpeed(long whatSpeed);
// mover method:
void step(int number_of_steps);
int version(void);
private:
void stepMotor(int this_step);
int direction; // Direction of rotation
unsigned long step_delay; // delay between steps, in ms, based on speed
int number_of_steps; // total number of steps this motor can take
int pin_count; // how many pins are in use.
int step_number; // which step the motor is on
// motor pin numbers:
int motor_pin_1;
int motor_pin_2;
int motor_pin_3;
int motor_pin_4;
int motor_pin_5; // Only 5 phase motor
unsigned long last_step_time; // time stamp in us of when the last step was taken
};
#endif