Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical Arduino Robotics

You're reading from   Practical Arduino Robotics A hands-on guide to bringing your robotics ideas to life using Arduino

Arrow left icon
Product type Paperback
Published in Mar 2023
Publisher Packt
ISBN-13 9781804613177
Length 334 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Lukas Kaul Lukas Kaul
Author Profile Icon Lukas Kaul
Lukas Kaul
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Selecting the Right Components for Your Robots
2. Chapter 1: Introducing Robotics and the Arduino Ecosystem FREE CHAPTER 3. Chapter 2: Making Robots Perceive the World with Sensors 4. Chapter 3: Making Your Robot Move and Interact with the World with Actuators 5. Chapter 4: Selecting the Right Arduino Board for Your Project 6. Part 2: Writing Effective and Reliable Robot Programs for Arduino
7. Chapter 5: Getting Started with Robot Programming 8. Chapter 6: Understanding Object-Oriented Programming and Creating Arduino Libraries 9. Chapter 7: Testing and Debugging with the Arduino IDE 10. Part 3: Building the Hardware, Electronics, and UI of Your Robot
11. Chapter 8: Exploring Mechanical Design and the 3D Printing Toolchain 12. Chapter 9: Designing the Power System of Your Robot 13. Chapter 10: Working with Displays, LEDs, and Sound 14. Chapter 11: Adding Wireless Interfaces to Your Robot 15. Part 4: Advanced Example Projects to Put Your Robotic Skills into Action
16. Chapter 12: Building an Advanced Line-Following Robot Using a Camera 17. Chapter 13: Building a Self-Balancing, Radio-Controlled Telepresence Robot 18. Chapter 14: Wrapping Up, Next Steps, and a Look Ahead 19. Index 20. Other Books You May Enjoy

Tuning and testing

There are a few parameters that we need to tune in order for the robot to function as expected. We can start with the directions in which the wheels turn. Our code assumes that if we pass a positive value to a motor’s SetPwm() function, the associated wheel spins forward. You can test this out by pressing the up arrow in the control pad on your phone and checking whether the wheels turn forward. If they spin the wrong way, you can either swap the order of the way the motor cables are plugged into the motor controller, or you can swap the values of the motor_dir_pin_A and motor_dir_pin_B variables for that motor.

The value of the button_increment variable determines how much the pmw value is increased for every button pressed on the control pad. The best value depends on the battery and the motors that you use. One press should be just enough to get the motors spinning reliably. You can do some testing and adjust the value accordingly.

The value of line_follow_pwm_offset...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime