How do you delay a setSpeed line?

As you see from the topic, how do you set a delay for a setSpeed line.

#include "CytronMotorDriver.h" //Include "Cytron Motor Library"
// Maker Line Sensor Pin Connection
#define LINE_D1   8
#define LINE_D2   7
#define LINE_D3   6
#define LINE_D4   5
#define LINE_D5   4
// Configure the motor driver.
CytronMD motorL(PWM_PWM, 11, 12);   // motor 1 = Left motor, M1A = Pin 3, M1B = Pin 9
CytronMD motorR(PWM_PWM, 9, 10); // motor 2= right motor, M2A = Pin 10, M2B = Pin 11

void setup() {
pinMode(LINE_D1, INPUT);
pinMode(LINE_D2, INPUT);
pinMode(LINE_D3, INPUT);
pinMode(LINE_D4, INPUT);
pinMode(LINE_D5, INPUT);
pinMode(2,INPUT_PULLUP);   //Define Pin 2 (connected to the on-board pushbutton) as input
while(digitalRead(2)==LOW); //wait for user to press the on-board pushbutton

void loop() {

The code is for my testing about the turn rate of my bot, its comprised of two DC motors. As you may see from the code above, i have tried to set a delay code to act as a stop function for my bot so I can pick it up. But it just keeps on turning and turning, not stopping at all. So I would like to know how do you set a delay. Thanks in advance.

Look at the examples from the library - if you want to stop a motor, you need to set speed to zero.

Yep solved it, my bad.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.