element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sixth Sense Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Sixth Sense Design Challenge
  • More
  • Cancel
Sixth Sense Design Challenge
Blog running with MCU controlled motor driver - Automatic Weeding Robot #8
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: weiwei2
  • Date Created: 9 Mar 2019 3:46 AM Date Created
  • Views 787 views
  • Likes 10 likes
  • Comments 3 comments
  • pwm pins
  • arduino ide
  • arduino ide to mbed
  • motor control applications
Related
Recommended

running with MCU controlled motor driver - Automatic Weeding Robot #8

weiwei2
weiwei2
9 Mar 2019

As i was testing nucleo64 in mbed notice that some arduino pin convention needs to be changed

for example, the pinMode in arduino need to be updated

pinMode(_pin1, OUTPUT)  ---> reconfigured as DigitalOut

i am wondering if there is any tutorial documentation that shows how to do conversion to MBED, listing every compatible command in arduino ide to what we have in MBED

 

Nonetheless, few days ago i tested with a MCU that uses the arduino IDE instead. Each of motor driver can be driven by a PWM pin and a directional pin. No grove shield is needed and this will save me one board

i want to verify that moving on grass has been resolved properly

 

My kid uploaded it at http://vt.tiktok.com/JLFovA/

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

so at least for sure now it is capable of running on its own on grass

 

to make it run, the arduino code is pretty simple

first put in the header file and define the pin in arduino ide style

 

#include "CytronMotorDriver.h"

// Configure the motor driver.
CytronMD motor1(PWM_DIR, 3, 4);   // PWM 1A = Pin 3, DIR=4 
CytronMD motor2(PWM_DIR, 5, 7); // PWM 2A = Pin 5, DIR=pin 7

 

then, define the moving command, here moving forward is shown

 

void movefront()
{
  motor1.setSpeed(128);   // Motor 1 runs forward at 50% speed.
  motor2.setSpeed(128);  // Motor 2 runs forward at 50% speed.
  delay(1000);
  
  motor1.setSpeed(255);   // Motor 1 runs forward at full speed.
  motor2.setSpeed(255);  // Motor 2 runs forward at full speed.
  delay(10000);


  motor1.setSpeed(0);     // Motor 1 stops.
  motor2.setSpeed(0);     // Motor 2 stops.
  delay(5000);  
}

 

then we can just call it move forward or backward, example

// The loop routine runs over and over again forever.
void loop() {
movefront();
delay(2000);
movefront();
delay(2000);
moveback();
delay(2000);
moveback();
}

  • Sign in to reply

Top Comments

  • dubbie
    dubbie over 6 years ago +3
    Very smooth movement, you are obviously making some good progress. Hopefully turning will be as smooth. Dubbie
  • DAB
    DAB over 6 years ago +3
    Good improvement over the original drive. DAB
  • genebren
    genebren over 6 years ago +2
    Great progress on your design challenge project. The platform is moving quite nicely. Keep up the good work! Gene
  • DAB
    DAB over 6 years ago

    Good improvement over the original drive.

     

    DAB

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 6 years ago

    Great progress on your design challenge project.  The platform is moving quite nicely.

     

    Keep up the good work!

     

    Gene

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 6 years ago

    Very smooth movement, you are obviously making some good progress. Hopefully turning will be as smooth.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube