#include <AccelStepper.h>
// Define a stepper and the pins it will use
AccelStepper stepper(AccelStepper::HALF4WIRE, 8, 9, 10, 11);
// Tested with a 10k linear pot between 5v and GND - works
int val = Serial.parseInt();
void setup()
{
stepper.setMaxSpeed(1000);
Serial.begin(9600);
}
void loop()
{
if (Serial.available()>0){
val = Serial.parseInt();
}
// Read new position
int val = Serial.parseInt();
stepper.moveTo(val);
stepper.setSpeed(1000);
stepper.runSpeedToPosition();
}
#include <AccelStepper.h>// Define a stepper and the pins it will useAccelStepper stepper(AccelStepper::HALF4WIRE, 8, 9, 10, 11);// Tested with a 10k linear pot between 5v and GND - worksint val = Serial.parseInt();void setup() {
Serial.begin(115200);}void loop() {stepper.run();// if there's any serial available, read it:while (Serial.available() > 0) {val = Serial.parseInt();// look for the newline. That's the end of your// sentence:if (Serial.read() == '\n') {stepper.moveTo(val);stepper.setMaxSpeed(1000);stepper.setAcceleration(500);}}}
#include <Stepper.h>
#define STEPS 200
Stepper stepper(STEPS, 8, 9, 10, 11);
int steps = 0;
void setup()
{
stepper.setSpeed(100);
Serial.begin(115200);
}
void loop(){
if (Serial.available()>0){
steps = Serial.parseInt();
Serial.println(steps);
}
if( steps != 0){
stepper.step(steps);
}
steps=0;
}
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have found some bug in the transcoding process of the floating value in vvvvv. It was sent ( transcoded as strings) like this: 100101102103104105106... without spaces. I modified the encoding method and now the values are sent with spaces:100 101 102 103 104 105 106.... Now it is better: the motor is moving according to the changing values but often there are impredictable jumpings, changes in moving direction, and finally the motor begin to rotate again infinitely. I think the problem is in the way in that the transcoded floating value is interpreted by the arduino sketch. But I`m a visual artist, not a programmer... I cannot dig in this thing more deeply without help. I use vvvv because it is a way of visual programming. The problem here is no more related to accelstepper library, but to the arduino`s coding language. Anyway, there is some good result, so thank you for your help!
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sorry, I know, my english is poor.... In my works I am experimenting the ways to combine some data analyzed by vvvv and to transmit this to change something in the real world. For example vvvv captures a realtime video, analize the persons motion in the view of camera, calculates the coordonates of moving pixels and I would like this values to be transmitted through serial to arduino to control in a proportional way the position of an object which could moved phisically by a stepper... If these coordinates are changing fast, now I am not able to control continously and in real time through serial port anything with my arduino. So my question is: it is possible the transfer of this kind of fast changing data from my computer to control a stepper motor? Thanks.
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I used a LCD instead of Serial.println(). .. Changing the first value from serial message the first motor moves accordingly, the LCD display it correctly. The second value from the LCD is not changing, but the second motor makes little budges, but remains in the same position. When I change the second value from the serial message, the second motor moves accordingly and the second value from LCD display it correctly. But the first (now unchanged) value on LCD is changing randomly and the first motor is moving randomly. So there is some problem with the way the serial messege is interpreted by arduino...
--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.