Jump to content
  • 0

uc32 with Motor shield


Marcus

Question

So I purchased a motor shield with the uc32. I wanted to control a couple of motors in order to drive my robot. Is there a library I have to include in my sketch. I know I can use the arduino IDE to control the uc32 with the motor shield. Also is there a certain way to declare the motors and is there a jumper I am supposed to remove in order to have the external power power the motors? Can anyone help please? Thank you.

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Thank you for the information. I was not precisely looking for PID control. I saw the picture and the person using this motor is also using a feedback system. What I was more so wondering is if the uC32 with the motorshield works more like the arduino with the adafruit motor shield. For example, the header must read

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *rightMotor = AFMS.getMotor(1);
Adafruit_DCMotor *leftMotor = AFMS.getMotor(2);
 

To declare the motors. Then in the void setup() you must add in AFMS.begin();

 

Then in the main body which is the void loop I would have something like this to control the left motor. First I set the motor speed then I call it to move forward for about 2 seconds. Does the chipkit uC32 with the motor shield have something similar. I want to be able to control each individual motor speed due to different scenarios I may encounter. Thank you.


   leftMotor->setSpeed(100);   
   leftMotor->run(FORWARD);
   delay(2000); 

 

Also, I am trying to connect the motors directly to the motor pins J5 and J7. Not through J6 and J3. These are just straight DC motors with no feedback.

Link to comment
Share on other sites

Hi @Marcus,

Looking into our library, it only provides functionality for the led's and buttons. We do not have an library/demo made for the motor shield that uses motor, servo or stepper's. I have found more code that would help with using a PID with J3 and J6(attached below) but not with using j5 and j7. I would suggest to start with the pins and steps described in section 2 motor controller of the reference manual above along with the correct setting on jp1 and jp2. 

cheers,

Jon

pidcontrol.pde

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...