look this over
seems that you only need to cycle the motor once, so no need to do it repeatedly in loop().
this code reads the pot and uses the pwm value from the pot.
do you need a calibration mode that allows you to determine the correct pwm value using the pot? would you then hardcode that value or still need the pot?
I don't have a monitor on it, i need it to read the pot continuously so the motor speed will change as motor is running in relation to the pot, then change directions when 2nd digital input is true and the 1st digital input is false. And no movement if both inputs are false
so ...
should the motor start when one digital input becomes active and then run for a fixed amount of time and stop and then reverse when a 2nd digital input becomes active and run for a fixed amount of time? if so, which pins and what state is active?
if the pot needs to be continually read, then delay() cannot be used. the code will need to use milliis() to determined when the time is expired to stop running or reverse.
(by any chance, is there an input that indicates when it should stop)?
why does the pot need to be continuously read? is someone going to be adjusting it each time the system runs? then why run for a fixed amount o time?
the arduino IDE has a serial monitor where prints are displayed.
which inputs are you using for fwd and rev? A1 and A2 or D1 and D2 ?
I need this to drive the mega shield, i sent you a copy of a program that runs the motor with feedback (which i don't want feedback)
but I do need to send output with push buttons and check the speed pot all the time.
const int enable = 8;
const int PWMA = 11;
const int PWMB = 3;
yes an operator will push a start cycle push button on a control panel that will cause an output from my plc to turn a start up input on the arduino unit true
this should cause the motor to run at the input value at A0 on the arduino until my plc turns the up input back to false and so on and so on until the plc teset cycle is done.
At that point the operator will come over check the readings then press plc cycle reset button which will cause an output from the plc to another input start down at the arduino unit
to run the motor back until the operator releases the plc button.
Hope I've explained it clearly enough.
in my plc language I would express it as follows
x1 input up
x2 input down
y0 drive out
Y1 drive in
PwmA drive up
PmwB drive down
Yes I thought i sent you a progane that does that, but it uses a feedback pot to control it direction and speed, i need only need input to control dir and a pot to control speed
Just "if input 5 is on read pot and write it to pmwA"
Or " if input 6 is on read pot and write topmwB"
Thats all I need it to do.
You can read the pot all your want but if your motor speed is not controllable via PWM it won't do you any good.
Have you tried my suggestion in post #18 ?
Did the speed change?
Connect one end of your pot to 5V and the other end to GND. Connect the wiper (center pin) to Arduino A0 and run the following program.
Does the speed change when you slowly turn the pot?