element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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
Arduino
  • Products
  • More
Arduino
Arduino Forum remote controlled car problem
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 5 replies
  • Subscribers 402 subscribers
  • Views 558 views
  • Users 0 members are here
  • coding
  • maker
  • pins
  • connect
  • help
  • control
  • b
  • separate
  • pot
  • servo
  • code
  • not
  • electrical
  • motor
  • arduino
  • analog
  • remote
  • j
Related

remote controlled car problem

dirtdiver
dirtdiver over 14 years ago

Hello everyone, here is the problem :

I'm making a remote control truck with the Arduino but the analog pins are just not enough.I have 2 analog pins left and I have to control 4 servos with potentiometers.

 

Now, my idea is to use the 1st pin for a pot that is separatet into 4 sections.Each section will connect the pot from the 2nd analog pin to servos 1-4.

I dont know if that is possible so please tell me if I can do that and how to do it.

Also if you can think of something else that solves my problem, feel free to share it!

Thanks for the help!

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 14 years ago +1 verified
    i did a similar build for a tech fair wat scale are you aiming for do you want full motor control or just partial
  • Former Member
    Former Member over 14 years ago in reply to dirtdiver +1
    In your "if" condition, do you mean to check the analogRead value of potpin1, instead of just the value of potpin1 (which is always set to 1), like so: if (analogRead(potpin1) > 500){
Parents
  • Former Member
    0 Former Member over 14 years ago

    i did a similar build for a tech fair wat scale are you aiming for do you want full motor control or just partial

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • dirtdiver
    0 dirtdiver over 14 years ago in reply to Former Member

    Well here's what I've wrote so far, you will get the idea of what Im tring to do.The code is not working and I dont really know why

     

    Servo myservo;  // create servo object to control a servo
    Servo myservo1;

    int potpin1 = 0;  // analog pin used to connect the potentiometer
    int potpin = 1;
    int val;    // variable to read the value from the analog pin

    void setup()
    {
      myservo.attach(9);  // attaches the servo on pin 9 to the servo object
    myservo1.attach(10);
    }

    void loop()
    {
      if (potpin1 > 500){
       val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
      val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
      myservo.write(val);                  // sets the servo position according to the scaled value
      delay(15);
      } else  {
      val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
      val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
      myservo1.write(val);                  // sets the servo position according to the scaled value
      delay(15);
      }
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 14 years ago in reply to dirtdiver

    In your "if" condition, do you mean to check the analogRead value of potpin1, instead of just the value of potpin1 (which is always set to 1), like so:

     

    if (analogRead(potpin1) > 500){

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 14 years ago in reply to dirtdiver

    In your "if" condition, do you mean to check the analogRead value of potpin1, instead of just the value of potpin1 (which is always set to 1), like so:

     

    if (analogRead(potpin1) > 500){

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • dirtdiver
    0 dirtdiver over 14 years ago in reply to Former Member

    Thanks man, it worked when i changed it!

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