Skip to content

ArduinoSapienza/VibrationMotor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino VibrationMotor Library v0.1.0

Arduino Logo

Overview

The Arduino VibrationMotor library provides a simple and modular way to manage a vibration motor connected to an Arduino board. The library includes functions for running both simple and complex vibration patterns, making it easy to integrate vibration feedback into your Arduino projects.

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 <VibrationMotor.h>
  2. Instantiate the VibrationMotor object:

    const int motorPin = 5;
    // Specify the pin to which the vibration motor is connected
    VibrationMotor myVibrationMotor(motorPin); 

Features

  • Constructor

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

       void on();
       Turn the vibration motor on.
  • Turn the Motor On with Intensity

       void on(uint8_t intensity);
  • Turn the Motor Off

       void off();
  • Pulse (Short On-Off)

       void pulse();
  • Pulse with Repetitions

       void pulse(int repetitions);
  • Pulse for a Specified Time (Custom On-Off)

       void pulseFor(int time);
  • Fade In Effect

       void fadeIn();
  • Fade Out Effect

       void fadeOut();

About

Library for managing a vibration motor

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages