I’m new to arduino and building a soft ramp up for a slot cars. I tried making a code from this site Robots + Big Data: Arduino Motor Docs
I can get the motor to start ramp from 0-30% in a second, and then ramp to 100% in second.
If I set start motor right away at 30% I can’t get a ramp after that. Coding is so confusing to me.
But this is what I really need
Want motor to start at 30% right upon power
Delay a second
Ramp up to 75% in a second
Delay a second
Ramp up to 100% in a second
#include <RBD_Timer.h>
#include <RBD_Motor.h>
RBD::Motor motor(6); // PWM pin
void setup() {
motor.rampPercent(30, 300); // Launch control
// Use motor.setSpeedPercent(10) "hits power instantly 10%"
// Use motor.rampPercent(30, 300) "ramps up to 0-30% in .3 seconds"
}
void loop() {
motor.update();
if(motor.onTargetSpeed()) {
// code only runs once per event
Serial.println("Target Speed");
delay(050); // Time between launch control and power adder
motor.rampPercent(100, 500); // Power after launch to finish
// use motor.setSpeedPercent(100) "hits power instantly"
// use motor.rampPercent(100, 300) "ramps up to 100% in .3 seconds"
}
}
delay(050);
If you want a 40 millisecond delay, why not simply delay(40);
TheMemberFormerlyKnownAsAWOL:
delay(050);
If you want a 40 millisecond delay, why not simply delay(40);
i have that changed, i was using 1000, 100 etc to see it in person while testing. this is going into a slot drag car that runs 22 ft in .7-1second