An input pin when nothing is connected (or an open switch in your case) is indeterminate, neither low nor high (i.e. bouncing in between). A pull-up resistor holds it gently but distinctly high, but allows a switch to ground to easily pull it distinctly low. The INPUT_PULLUP enables a built-in pullup resistor.

A pull-down resistor addresses the same problem in the opposite way, but there is no built-in (you would have to provide externally)....

digitalWrite(12, HIGH); //Establishes forward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A digitalWrite(3, 255); //Spins the motor on Channel A at full speed digitalWrite(13, HIGH); //Establishes forward direction of Channel B digitalWrite(8, LOW); //Disengage the Brake for Channel B digitalWrite(11, 255); //Spins the motor on Channel B at full speedbut pins 3 and 11 are not defined as outputs so will default to being inputs so will not behave as outputs

At no time are 6 pins (3 per motor) defined as outputs and used in the sketch.

One useful thing to do would be to give the pins meaningful names which would make reading the code easier.I am in agreement with John that the full sketch be put aside for now and that a start should be made with small steps.

Please do not send me PMs asking for help. Post in the forum then everyone will benefit from seeing the questions and answers.

The fact remains that neither sketch uses 3 pins defined as outputs to control the shield.

Motor channel A uses pin 12 to control direction, pin 9 for braking and pin 3 to control speed whilst motor channel B uses pin 13 to control direction, pin 8 for braking and pin 11 to control speed. Pins A0 and A1 are used for current sensing if required, but are not necessary unless current sensing is needed.

There are a number of things wrong with your sketch such as reading an analog value from the bump pins then testing whether the value(s) are HIGH. This could work but it would be more normal to read the digital value and test it for HIGH/LOW.

void loop() { val = analogRead(bumpPin1); randNumber = random(600, 1500); if (val == HIGH) { // if no objects detected on bump sensor right digitalWrite(12, HIGH); //Establishes forward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A digitalWrite(3, 255); //Spins the motor on Channel A at full speed digitalWrite(13, HIGH); //Establishes forward direction of Channel B digitalWrite(8, LOW); //Disengage the Brake for Channel B digitalWrite(11, 255); //Spins the motor on Channel B at full speedpins 3 and 11 are used as outputs but are not defined as such.You need to start with simple sketches that run the motor(s) and work from thereTry this

Have you been able to get your motor to even turn on, using the code I posted in reply #11 or UKHeliBobs in #20?

This would confirm whether your shield is working and your wiring is valid...

John

I was at work all day and didn't get to tinker. Just got home and finished dinner and a grocery shop will attempt the tinker now. Have to go downstairs and load your sketch to the UNO and hook it up to see.

void loop() // This one loops over and over{ leftMotor( FORWARD, FULLSPEED); delay( 4000); // on and off every 4 seconds leftMotor( FORWARD, 0 ); delay( 4000);} // it goes from here back to the start of loop *instantly*

I would recommend removing the indicated *** lines in setup, Compile and run, the motor should go on 4 seconds and then off 4 seconds, on 4, off 4. Then in loop() just change the leftMotors()s to rightMotor(). You're just making sure the motor works here.Also see if you can add the lines in the loop, to test the reverse: right fwd full delay right fwd 0 (stop) delay right reverse full delay

Modify for both motors fwd, 1 fwd 1 reverse, half speed (128), etc.

Make sure you understand the concept that setup runs once, first-- and loop then runs forever, over and over.