Having Arduino and Gobetwino wait for eachother to continue
so have been working on project has stepper motor , driver turn amount of microsteps , stop, wait button press , continue on until maximum amount of button presses reached. using arduino uno r3, , following driver/motor.
http://www.automationdirect.com/adc/shopping/catalog/motion_control/stepper_systems/stepper_drives_-z-_power/stp-drv-4035
http://www.automationdirect.com/adc/shopping/catalog/motion_control/stepper_systems/stepper_motors_-z-_cables/stp-mtr-17040
now have functioning code , want replace button press actual intended function. want stepper move , send signal gobetwino hit "enter" button. take light measurement in excel sheet controls cl 200a light meter. want arduino wait until measurement finished , have gobetwino tell arduino continue. should repeated until maximum amount of measurements has been reached.
http://www.konicaminolta.com/instruments/download/instruction_manual/light/pdf/cl-200a_instruction_eng.pdf
i have looked through gobetwino manual , looked around online, have not found whether or not done or whether there may other alternative?
any ideas appreciated!
http://www.automationdirect.com/adc/shopping/catalog/motion_control/stepper_systems/stepper_drives_-z-_power/stp-drv-4035
http://www.automationdirect.com/adc/shopping/catalog/motion_control/stepper_systems/stepper_motors_-z-_cables/stp-mtr-17040
now have functioning code , want replace button press actual intended function. want stepper move , send signal gobetwino hit "enter" button. take light measurement in excel sheet controls cl 200a light meter. want arduino wait until measurement finished , have gobetwino tell arduino continue. should repeated until maximum amount of measurements has been reached.
http://www.konicaminolta.com/instruments/download/instruction_manual/light/pdf/cl-200a_instruction_eng.pdf
i have looked through gobetwino manual , looked around online, have not found whether or not done or whether there may other alternative?
any ideas appreciated!
code: [select]
#include <accelstepper.h>,
int x = 10; // x represents amount of measurments taken on x axis
int d = 5; // number of degrees between measurments
int stepsize = 27.78 * d; //accounts microsteps
accelstepper stepper(1, 3, 2); // define stepper , pins use. 1 means 2 wires. 3 step pin, 2 dirpin
int fullrev = 10000;
int quarterrev = 2500;
int inpin = 7; // button
int outpin = 3; // step pin
int dirpin = 2; // direction pin
int state = 1; // current state of output pin
int reading; // current reading input pin
int buttonpresscount = 0; //start value of how many times button has been pressed.
int led = 13; //pin 13 our led.
void setup()
{
pinmode(inpin, input);
pinmode(outpin, output); //setting inputs , outputs
pinmode(led, output);
stepper.setmaxspeed(1000);
stepper.setacceleration(1500); //acceleration @ 1500 steps per second
}
void loop()
{
if (state == 1) //state1
{
digitalwrite(led,high);
reading = digitalread(inpin); //read pin
if (reading == high)
{
state = 2; //state 2
}
}
if (state == 2 && buttonpresscount < x)
{
digitalwrite(led,low);
stepper.move(stepsize);
buttonpresscount++;
state = 3; //state 3
}
if (state == 3)
{
if (stepper.distancetogo() == 0)
{
state = 1; //state 1
}
if (state == 2 && buttonpresscount >=x)
{
stepper.stop();
//state = 4; //state 4
}
}
stepper.run();
}
i want arduino wait until measurement finished
what options available tell when measurement finished?
Arduino Forum > Using Arduino > Project Guidance > Having Arduino and Gobetwino wait for eachother to continue
arduino
Comments
Post a Comment