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
CodeBug
  • Learn
  • Learning Center
  • STEM Academy
  • CodeBug
  • More
  • Cancel
CodeBug
Forum CodeBug Driving a Servo
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join CodeBug to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 11 subscribers
  • Views 1766 views
  • Users 0 members are here
  • pwm_controller
  • code_bug
  • codebug
  • servo
  • servo_driver
  • servo_control
Related

CodeBug Driving a Servo

spannerspencer
spannerspencer over 10 years ago

I picked up a codebug the other day, when I met the guys who created it, and had a quick lash with it this evening. I've got a personal project in mind that involves driving at least one servo (probably two), and I was curious as to whether the CodeBug could be the brains behind it.

 

A little bit of jitter, but turns out it works pretty damn well! More than adequate for my project's needs (more on that as it takes shape. Hint: pop culture fans will love it!). Sorted!

 

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

  • Sign in to reply
  • Cancel

Top Replies

  • Jan Cumps
    Jan Cumps over 10 years ago +1
    For the win! That's not jitter. That's smooth.
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to spannerspencer +1
    Should make a try in some way. But I have just an idea. Thank you for the code Spanner. Enrico
Parents
  • Jan Cumps
    Jan Cumps over 10 years ago

    For the win!

    That's not jitter. That's smooth.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • spannerspencer
    spannerspencer over 10 years ago in reply to Jan Cumps

    It's not too bad, yeah image

     

    It's even better now, as I've adjusted how it works. Rather than button A moving it in one direction and button B moving it back, I've set specific positions (this is what the project will need). So now, when you press button A it immediately (and smoothly) moves to the first position. Press button A again, and it switches to the other position.

     

    One small issue is that if you hold button A down, it continually rotates between the two positions, which is something I'd like to eliminate. Still though, the CodeBug's doing me proud! image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to spannerspencer

    How did you managed the PWM servo control ? I am curious...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • spannerspencer
    spannerspencer over 10 years ago in reply to balearicdynamics

    It all went with surprising ease. I've just published the code I used over on the CodeBug site, if you'd like to take a look at it: http://www.codebug.co.uk/explore/codebug/805/

     

    By the way -- if you can see a way to stop the servo running back and forth between the two positions if you hold down button A, that'd be much appreciated! I'd prefer that you have to release button A and press it again in order for the servo to move back.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to spannerspencer

    Should make a try in some way. But I have just an idea.

     

    Thank you for the code Spanner.

     

    Enrico

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • kiphansen
    kiphansen over 10 years ago in reply to spannerspencer

    Spencer --  Instead of a Pause at the end, add in a check for "not - Button A - pressed" --  loop that to prevent the code from continuing until Button A is found NOT PRESSED (ie: released) before looping back to the "if Button A pressed" line.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • kiphansen
    kiphansen over 10 years ago in reply to spannerspencer

    Spencer --  Instead of a Pause at the end, add in a check for "not - Button A - pressed" --  loop that to prevent the code from continuing until Button A is found NOT PRESSED (ie: released) before looping back to the "if Button A pressed" line.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • spannerspencer
    spannerspencer over 9 years ago in reply to kiphansen

    Ah, interesting idea -- I'll add that in. Funnily enough, this project will be using a foot switch, and I ordered a latching one by mistake. But it could actually work very nicely using this method. Nice one kiphansen!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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