ok i dont know why this is not working pot pin with steps

  sensepinState = analogRead(0);// read the input pin:
  delay(10);
  int sensepinState = analogRead(0);

Putting a delay between populating the global variable and creating and populating the local variable of the same name does not make it any less stupid.

  sensepinState = analogRead(0);// read the input pin:
  int sensepinState = analogRead(0);

I feel a great disturbance in the Force.

ok well im not at all sure what you want me to to do about it ? thats all i have been able to come up with for a working program the delay alows just a moment between reads where the pot is in motion and standing still then with out this delay it reads sensepin and last sensepin as the same every time with the delay its out of range i guess... example start turning the pot drom 0 to 500 befor it moves the last S.p
and the
new s.p. read

will be 0 and 0

then 0 as last then 7 for new that is now a false == so it runs the stepper loop once

then when i stop turning the pot at 500 i get this

479 LAST 500 NEW \ as it chetchs up
500 last 500 new \ next time thro loop after pot has not been moved
now it runs the eles statment.. if you think these another way to do this give me an example
this is all i could come up with not knowing what im doing .. it may not look good to any one eles but i was proud of my self .. hahaha.. :slight_smile:

Well we all learn by doing. So it's great you are doing that.

In your code you have the variable "lastsensepinState". You compare it, but never change it. Is that an oversight?

im not at all sure what you want me to to do about it ?

Get rid of the local variable with the same name as the global variable. There is no reason to, on every pass through loop(), read the same pin twice in succession.

ok in the beginning of the loop del the sen.pin sen.pin ... yeah i stare at the code for soo long it blended to geather i guess i dont see how i missed that it was repeating .. so there then that it should be fine . i would like to bread board it out and build it on a small pcb board with a attiny to instal on a bigger project..

oh i forgot to mention this got so busy with trying to make my code right ... is there a way to extract the diffrance between the reads and store it to use as a val or mulipyer for my step spead like i vave done with the code i have useing the sensor value ?

in example : if i turn the pot slow the comaped reads will have a diffrence of 1 or 2 then turning fast wouuld leave me a diffrence of 40 to 80 ish ... so then have the code figuer out what the diffrence is and use it as an out put value to change the step speed ..

is there a way to extract the diffrance between the reads and store it to use as a val

Yes it is called subtraction. If you subtract one reading from the other you get the difference.
If you do not want the direction of the difference then use the abs() function to remove any negative sign.

ok sweet it all works fine now ... so now i can move on to the bigger project this took me cupple hours here and there thank you all for your help ... i woulda been throwing things out the window by today hahaha...