Buttons '+' '-'

Hi All
This is my first post. I have ordered Arduino mega! (I’ll receive it by next weekend). I want help in my writing a simple code for CNC machine I have written majority of code I’m confused only with two steps.

  1. I want to input number in my code so I’m having two buttons marked as ‘+’ and ‘-’ initially variable(assuming it as i) is zero for every press of ‘+’ i should increment and on pressing ‘-’ it should decrease but value of i should not exceed 999. when i press button labeled as “Enter” Arduino should accept my value and execute the code. (I have connected LCD to display value) (Is there any way to do away with enter button?)

  2. I want to run two stepper motor together and then some point in program one after another.
    following will run motors one after another. How to implement code to start them simultaneously?
    motorA.step(50, Forward);
    motorB.step(100, Forward);

You can use my phi_prompt user interface library. There is a function to input integer. It has low and high limits and step size so you can say low=0, high=999, step=1. Take a look:

This example asks for a number between 0 and 20 with step size 2.

How to implement code to start them simultaneously?

Do not use that stepping motor library but write your own code to drive the motors. What sort of driver do you have. Are you generating the switching patterns or are you using a step and direction type.

Sorry for late reply! I'll post my code in couple of days. @Grumpy_Mike Im using L298 for motor and im using step() function. @liudr thanks for helping!