Hello, what im trying to do is when i press the button the gearmotor will start accelerating from 0 to 255 rpm every second by 10 rpm. And after i let the button go the gearmotor will start going down by 10rpm every second until 0.
I cant find a solution for this the closest think i found was changing acceleration with potentiometer but even then it was too fast and vent overboard.
Is there even a solution for this or some way to do this ?
Is there a linear relationship between the PWM value used to control the speed of the motor and its actual speed ?
If so you could amend the BlinkWithoutDelay example to add to the PWD value every 10 seconds whilst the button is pressed and back down again when it is not pressed
If the relationship is not linear you could still use the BWoD principle and look up the values to be written in an array or possibly by calculating them on the fly if you can write a suitable function
Hello
Please comment your sketch an put resonable names to pin numbers.
And the second step think about a motor control function like motor(int direction) using this enummeration enum{Stop,Left,Right}. At least you need a timer() function, easily derived from the BWoD example as already above mentioned.
Hello
I´ve found a similar sketch in my sketch box and I´ve made some mods with respect to your opening post. The output can be used as control input for a RPM regulation.