Hellow
I just starting to use Arduino. In my school we are using a robot car for some test.
Has someone an idea how i can accelerate my car from 0 to .....? 0 to 250
I can't find an arduino code for this. Can someone help me.
Thanks
smart Robot car
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- martijn_schepkens
- Posts: 1
- Joined: Sun Oct 18, 2015 3:20 am
smart Robot car
- Attachments
-
- Free-shipping-4-set-Smart-Car-Robot-Plastic-Tire-Wheel-Tyre-DC3-6V-Gear-Motor-For.jpg (44.85 KiB) Viewed 395 times
-
- Hot-For-2WD-DIY-Motor-Smart-Robot-Car-Chassis-Kit-Speed-Encoder-Battery-Box-Remote-Control.jpg (399 KiB) Viewed 395 times
- adafruit_support_bill
- Posts: 88092
- Joined: Sat Feb 07, 2009 10:11 am
Re: smart Robot car
What motor shield are you using? The library for your motor shield should have some function to set the speed. You just need to write a loop to increment through the speeds:
something like this:
something like this:
Code: Select all
void accelerate(int start, int end, int milliseconds)
{
int interval = milliseconds / abs(end - start);
for (int i = start; i < end; i++)
{
motor.setSpeed(i);
delay(interval);
}
}
Please be positive and constructive with your questions and comments.