Skip to content

The Arduino DCMotor library provides a simple and modular way to manage a DC motor connected to an Arduino board using the **L293D** motor driver.

License

Notifications You must be signed in to change notification settings

ArduinoSapienza/DCMotor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino DCMotor Library v1.0.0

Arduino Logo

Overview

The Arduino DCMotor library provides a simple and modular way to manage a DC motor connected to an Arduino board using the L293D motor driver.

Installation

  1. Download the Library:

    • Click on the "Code" button in the GitHub repository.
    • Select "Download ZIP" to download the library as a ZIP file.
  2. Extract the ZIP File:

    • Extract the contents of the ZIP file to your Arduino libraries directory.
  3. Restart the Arduino IDE:

    • Restart the Arduino IDE to ensure that the library is recognized.

Usage

  1. Include the Library:

    #include <DCMotor.h>
  2. Instantiate the VibrationMotor object:

    // Specify the pins of the L293D motor driver: (A, B, S)
    // A --> direction A
    // B --> direction B
    // S --> speed pin (PWM)
    DCMotor motor(2, 4, 9); 

Features

  • Constructor

       // Initialize the VibrationMotor with the specified Arduino pin.
       VibrationMotor(uint8_t motorPin);
  • Turn the Motor On

       // Turn on the motor with a given speed. 
       // The speed in in range [-255, 255] where the sign determines the direction.
       void on(int speed);
  • Turn the Motor On for a given time

       // Turn on the motor with a given speed and for a given time in millisec. After, the motor turns off.
       void on(int speed, int millisec);
  • Turn the Motor Off

       void off();

About

The Arduino DCMotor library provides a simple and modular way to manage a DC motor connected to an Arduino board using the **L293D** motor driver.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages