would like to ask for help, do not get the setup to run.
UNO runs fine, but Mega not, what is the difference?
Library: all with Motor Shield tried / installed
running this Code:
const int MotorPinA = 12; // for motor A
const int MotorSpeedPinA = 3; // for motor A
const int MotorBrakePinA = 9; // for motor A
const int CW = HIGH;
const int CCW = LOW;
void setup() {
// motor A pin assignment
pinMode(MotorPinA, OUTPUT);
pinMode(MotorSpeedPinA, OUTPUT);
pinMode(MotorBrakePinA, OUTPUT);
Serial.begin(9600);// seial monitor initialized
}
void loop() {
//start motor A at maximum speed
digitalWrite(MotorPinA, CW);// set direction
Serial.println("Direction CW");
analogWrite(MotorSpeedPinA, 100);// set speed at maximum
Serial.println("Speed 100");
delay(5000);// run for 5 seconds
digitalWrite(MotorBrakePinA, HIGH);// brake
Serial.println("Brake applied");
delay(2000);
digitalWrite(MotorBrakePinA,LOW);// release brake
Serial.println("Brake removed");
digitalWrite(MotorPinA, CCW);// set direction
Serial.println("Direction CWW");
analogWrite(MotorSpeedPinA, 70);// set to 1/3
Serial.println("Speed at 70");
delay(5000);//
}// loop end
Maybe some pics of how the shield is mounted on the mega.
Also are you using the MEGA to power the board or an external source.
If it is an external source have you used either a jumper or track cut to tell the shield to use external power ?
Hi,
Shield on Mega is mounted to the pins as shown on Mega and Shield, means in front to usb. So the shield is mounted on the Mega is the same as UNO.
Only the ext. Power of the shield is used, UNO & Mega are powerd over it via Vin (when plugged into PC, also via USB).
Do not know of a jumper on the shield, only the cuttable connection on the backside, but still good to power UNO / Mega.
Clear, or still something not told? Just reply i try my best to answer as good as possible.