Comments (10)
Expansion of functionality is through inheritance. What you need to do is just place AccelStepper and iAccelStepper library in their folders in the libraries
folder, like this
[bash]$ ls sketchbook/libraries/{,i}AccelStepper
sketchbook/libraries/AccelStepper:
AccelStepper.cpp AccelStepper.h AccelStepper.h.save doc examples keywords.txt LICENSE Makefile MANIFEST project.cfg
sketchbook/libraries/iAccelStepper:
AccelStepper.patch iAccelStepper.cpp iAccelStepper.h keywords.txt LICENSE README.md
User added libraries are located in the same ${SKETCH_FOLDER} can be checked in the preference file ~/.energia/preferences.txt.
sketchbook.path=/home/simon/src/emb/ti/sketchbook
Energia would find libraries in the folders:
sketchbook.path=/home/simon/src/emb/ti/sketchbook/libraries
In the compiler output I can see that you still do not have your AccelStepper.h modified to expose necessary members to a inherited object. You can either apply provided patch or manually edit .h file
I hope that helps.
s.
from iaccelstepper.
thank you for the explanation.
ill test asap
from iaccelstepper.
im still having problems.
- both AccelStepper and iAccelStepper in my library folder
- applied patch manually on version 1.45 (1.39 failed as well)
i testes against the proportional control sketch
#include <iAccelStepper.h>
#include <AccelStepper.h>
// Define a stepper and the pins it will use
AccelStepper stepper(AccelStepper::DRIVER, 3 ,4); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
// This defines the analog input pin for reading the control voltage
// Tested with a 10k linear pot between 5v and GND
#define ANALOG_IN A0
void setup()
{
stepper.setMaxSpeed(1000);
}
void loop()
{
// Read new position
int analog_in = analogRead(ANALOG_IN);
stepper.moveTo(analog_in);
stepper.setSpeed(100);
stepper.runSpeedToPosition();
}
[/opt/energia/hardware/tools/lm4f/bin/arm-none-eabi-g++, -c, -g, -Os, -w, -fno-rtti, -fno-exceptions, -ffunction-sections, -fdata-sections, -mthumb, -mcpu=cortex-m4, -mfloat-abi=hard, -mfpu=fpv4-sp-d16, -fsingle-precision-constant, -DF_CPU=120000000L, -MMD, -DARDUINO=101, -DENERGIA=12, -I/opt/energia/hardware/lm4f/cores/lm4f, -I/opt/energia/hardware/lm4f/variants/launchpad_129, -I/opt/energia/hardware/lm4f/libraries/iAccelStepper, -I/opt/energia/hardware/lm4f/libraries/AccelStepper, /tmp/build8455673332897300192.tmp/ProportionalControl.cpp, -o, /tmp/build8455673332897300192.tmp/ProportionalControl.cpp.o]
ProportionalControl.pde:15:27: error: no matching function for call to 'AccelStepper::AccelStepper(int, int, int)'
ProportionalControl.pde:15:27: note: candidates are:
In file included from /opt/energia/hardware/lm4f/libraries/iAccelStepper/iAccelStepper.h:5:0,
from ProportionalControl.pde:11:
/opt/energia/hardware/lm4f/libraries/AccelStepper/AccelStepper.h:308:5: note: AccelStepper::AccelStepper(void (*)(), void (*)())
/opt/energia/hardware/lm4f/libraries/AccelStepper/AccelStepper.h:308:5: note: candidate expects 2 arguments, 3 provided
In file included from /opt/energia/hardware/lm4f/libraries/iAccelStepper/iAccelStepper.h:5:0,
from ProportionalControl.pde:11:
/opt/energia/hardware/lm4f/libraries/AccelStepper/AccelStepper.h:298:5: note: AccelStepper::AccelStepper()
/opt/energia/hardware/lm4f/libraries/AccelStepper/AccelStepper.h:298:5: note: candidate expects 0 arguments, 3 provided
/opt/energia/hardware/lm4f/libraries/AccelStepper/AccelStepper.h:251:7: note: AccelStepper::AccelStepper(const AccelStepper&)
/opt/energia/hardware/lm4f/libraries/AccelStepper/AccelStepper.h:251:7: note: candidate expects 1 argument, 3 provided
from iaccelstepper.
That looks like new problems.
You need to declare the iAccelStepper to make use of the inherited type, instead of AccelStepper.
I observed that, at least under Energia, it must be declared with a default constructor (empty list of arguments), and instead "configured" with a .begin()
method in the body of setup()
function. That's why in the patch you should see that the original constructor is renamed to a begin method:
-AccelStepper::AccelStepper(uint8_t interface, uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4, bool enable)
+void AccelStepper::begin(uint8_t interface, uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4, bool enable)
Further the arguments of iAccelStepper::begin() is different than AccelStepper::begin()
void begin(uint8_t STEP = 2, uint8_t DIR = 3, uint8_t ENABLE = 4);
The driver type is fixed to an equivalent of DRIVER in AccelStepper. Implementation of other drivers (e.g. FULL4WIRE or HALF4WIRE) should be quite simple.
I still see that the headers files (AccelStepper.h and iAccelStepper.h) are located in the Energia system folder, instead of sketches/libraries folder (like /home/user/folder/where/you/keep/your/sketch_projects/libraries
). Are you sure you modified the correct .h file?
Another remark: this driver does not require to call the .run()
(or .runSpeed()
to be precise) as frequent as possible. The execution is taken care by the driver itself by assigning the ISR. What is needed to run is just to call the method .more()
or .moveTo()
. Further for a simple test, the constant speed is not necessary. In loop()
one need just set the target position:
#include <iAccelStepper.h>
#include <AccelStepper.h>
// Define a stepper and the pins it will use
iAccelStepper stepper;
// This defines the analog input pin for reading the control voltage
// Tested with a 10k linear pot between 5v and GND
#define ANALOG_IN A0
void setup()
{
stepper.begin(3 ,4);
}
void loop()
{
// Read new position
int analog_in = analogRead(ANALOG_IN);
stepper.moveTo(analog_in);
}
from iaccelstepper.
ok, some progress.
i successfully compiled your attached example for the STELLARIS board .
but it seems not to support the TIVA (TM4C129) board which is the one i used.
thanks so much for your detailed help.
from iaccelstepper.
Indeed I am using it for Stellaris launchpad (TM4C123GH6PM). Try adding another chip in the lines #13 and #29
#if defined(PART_TM4C1233H6PM) || defined(PART_LM4F120H5QR) || defined(PART_TM4C129XNCZAD)
s.
from iaccelstepper.
ill try, where did you get the part ID, i looked for that one...
oh, i see https://github.com/energia/Energia/blob/master/hardware/lm4f/cores/lm4f/Energia.h
from iaccelstepper.
Can you confirm if suggested modification (see comment 61448560) works on your test setup?
from iaccelstepper.
sorry a shorted that board :(
On Fri, Jan 9, 2015 at 2:31 PM, sq7bti [email protected] wrote:
Can you confirm if suggested modification (see comment 61448560) works on
your test setup?—
Reply to this email directly or view it on GitHub
#1 (comment).
yair99@gmail
050-6301212
tlv, israel
from iaccelstepper.
oop confirmed solution
from iaccelstepper.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iaccelstepper.