I was given the task of being able to drive two motors in the forward direction, able to drive two motors in the reverse direction, and they must be able to drive each motor independently. I was wondering if anyone can give me directions, advice, or tips on the coding for this task. All I know is that: if(switchState == HIGH){ digitalWrite(motorPin, HIGH); } else{ digitalWrite(motorPin, LOW); } } I know this code makes the motor turn on and off with the high and low, but what type of code do I use to make it work at a certain speed, and to move independently?

closed as too broad by gre_gor, Michel Keijzers, VE7JRO, MatsK, per1234 Apr 8 '18 at 14:17

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Welcome to Arduino:SE. Please be aware that this is not a free design house or an on-demand online technical encyclopedia. Please revise your question showing your work and findings so far. You might find it helpful to review the site tour and Help Centre and, in particular, How to Ask. – sempaiscuba Apr 6 '18 at 15:46
  • given the task .... is this school work? – jsotola Apr 6 '18 at 18:10
  • There are plenty oft tutorials in the web. Google and follow one of them – chrisl Apr 8 '18 at 14:17

you can use PWM function of digital pins (analogWrite())to control the motor speeds as desired.

Not the answer you're looking for? Browse other questions tagged or ask your own question.