Giter VIP home page Giter VIP logo

adafruit_drv2605_library's Introduction

Adafruit DRV2605 Library Build Status

This is a library for the Adafruit DRV2605L Haptic Driver ----> http://www.adafruit.com/products/2305

Check out the links above for our tutorials and wiring diagrams.

This motor/haptic driver uses I2C to communicate.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.

MIT license, all text above must be included in any redistribution.

adafruit_drv2605_library's People

Contributors

carsonmcdonald avatar caternuson avatar drak7 avatar evaherrada avatar ladyada avatar paintyourdragon avatar rei-vilo avatar siddacious avatar sirwilliamt avatar tdicola avatar timothy-fuchs avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_drv2605_library's Issues

Range of decimal values for setRealtimeValue function

Hi I am not sure about the range of values using setRealtimeValue function as decimal values. I am using normalized values [1 - 127] and I would like to be sure about the expected range. I have read the doc again but I can not find this point. Thanks.

Problem using the drv library with new TwoWire interface. Possible solution proposed.

Hi there,

First, thanks for a great job on this library. I have come across a problem, for which I think I have a solution. But I wanted to run it by you first.

I am combining the reconfiguration of pins to create a new TwoWire interface on an M0 feather. with use of the DRV2605 library.

For creating the TwoWire interface, I am following the process outlined here: https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/creating-a-new-wire I can successfully create this interface and I can detect the DRV2605 on this interface using the sketch i2c_scanner.

But when I try to use the DRV2605 library, I can't get it to work. What is suspect to me is the line in the library that says _wire->begin(); I am suspicious that the calling of begin() twice, first by me in setup(), then by the library, is the problem. If I comment that line out of the library, the code works.

My code follows below. I am happy to run any additional tests. Or, if you have a prescribed procedure for using a new TwoWire interface with the library, that would be great.

Thanks again for a great library!

All the best,
Ray

`/*
The first new WIRE will use pin numbers 22 (SDA) and 38 (SCL).
The relationship between Arduino pin numbers, the M0 port and pin names
and the M0 serial peripheral used are in the following table.

 Arduino         M0         M0 Serial
Pin Number    I/O Pin    Peripheral Used
22 for SDA      PA12       SERCOM2.0
38 for SCL      PA13       SERCOM2.1

*/

// Create Wire for the haptic driver
TwoWire HapticWire(&sercom2, 22, 38);

Adafruit_DRV2605 drv;

void setup() {

HapticWire.begin(); // Initialize Haptic Wire (I2C) interface.

// Assign pin number 22 and 38 to SERCOM functionality
pinPeripheral(22, PIO_SERCOM);
pinPeripheral(38, PIO_SERCOM);

drv.begin(&HapticWire); // Thinking, per the source, that this will point to the new I2C port.

drv.selectLibrary(1);

// I2C trigger by sending 'go' command
// default, internal trigger when sending GO command
drv.setMode(DRV2605_MODE_INTTRIG);

}

uint8_t effect = 1;

void loop() {
// Serial.print("Effect #"); Serial.println(effect);

if (effect == 1) {
Serial.println("11.2 Waveform Library Effects List");
}

if (effect == 1) {
Serial.println(F("1 − Strong Click - 100%"));
}
if (effect == 2) {
Serial.println(F("2 − Strong Click - 60%"));
}
if (effect == 3) {
Serial.println(F("3 − Strong Click - 30%"));
}
if (effect == 4) {
Serial.println(F("4 − Sharp Click - 100%"));
}
if (effect == 5) {
Serial.println(F("5 − Sharp Click - 60%"));
}
if (effect == 6) {
Serial.println(F("6 − Sharp Click - 30%"));
}
if (effect == 7) {
Serial.println(F("7 − Soft Bump - 100%"));
}
if (effect == 8) {
Serial.println(F("8 − Soft Bump - 60%"));
}
if (effect == 9) {
Serial.println(F("9 − Soft Bump - 30%"));
}
if (effect == 10) {
Serial.println(F("10 − Double Click - 100%"));
}
if (effect == 11) {
Serial.println(F("11 − Double Click - 60%"));
}
if (effect == 12) {
Serial.println(F("12 − Triple Click - 100%"));
}
if (effect == 13) {
Serial.println(F("13 − Soft Fuzz - 60%"));
}
if (effect == 14) {
Serial.println(F("14 − Strong Buzz - 100%"));
}
if (effect == 15) {
Serial.println(F("15 − 750 ms Alert 100%"));
}
if (effect == 16) {
Serial.println(F("16 − 1000 ms Alert 100%"));
}
if (effect == 17) {
Serial.println(F("17 − Strong Click 1 - 100%"));
}
if (effect == 18) {
Serial.println(F("18 − Strong Click 2 - 80%"));
}
if (effect == 19) {
Serial.println(F("19 − Strong Click 3 - 60%"));
}
if (effect == 20) {
Serial.println(F("20 − Strong Click 4 - 30%"));
}
if (effect == 21) {
Serial.println(F("21 − Medium Click 1 - 100%"));
}
if (effect == 22) {
Serial.println(F("22 − Medium Click 2 - 80%"));
}
if (effect == 23) {
Serial.println(F("23 − Medium Click 3 - 60%"));
}
if (effect == 24) {
Serial.println(F("24 − Sharp Tick 1 - 100%"));
}
if (effect == 25) {
Serial.println(F("25 − Sharp Tick 2 - 80%"));
}
if (effect == 26) {
Serial.println(F("26 − Sharp Tick 3 – 60%"));
}
if (effect == 27) {
Serial.println(F("27 − Short Double Click Strong 1 – 100%"));
}
if (effect == 28) {
Serial.println(F("28 − Short Double Click Strong 2 – 80%"));
}
if (effect == 29) {
Serial.println(F("29 − Short Double Click Strong 3 – 60%"));
}
if (effect == 30) {
Serial.println(F("30 − Short Double Click Strong 4 – 30%"));
}
if (effect == 31) {
Serial.println(F("31 − Short Double Click Medium 1 – 100%"));
}
if (effect == 32) {
Serial.println(F("32 − Short Double Click Medium 2 – 80%"));
}
if (effect == 33) {
Serial.println(F("33 − Short Double Click Medium 3 – 60%"));
}
if (effect == 34) {
Serial.println(F("34 − Short Double Sharp Tick 1 – 100%"));
}
if (effect == 35) {
Serial.println(F("35 − Short Double Sharp Tick 2 – 80%"));
}
if (effect == 36) {
Serial.println(F("36 − Short Double Sharp Tick 3 – 60%"));
}
if (effect == 37) {
Serial.println(F("37 − Long Double Sharp Click Strong 1 – 100%"));
}
if (effect == 38) {
Serial.println(F("38 − Long Double Sharp Click Strong 2 – 80%"));
}
if (effect == 39) {
Serial.println(F("39 − Long Double Sharp Click Strong 3 – 60%"));
}
if (effect == 40) {
Serial.println(F("40 − Long Double Sharp Click Strong 4 – 30%"));
}
if (effect == 41) {
Serial.println(F("41 − Long Double Sharp Click Medium 1 – 100%"));
}
if (effect == 42) {
Serial.println(F("42 − Long Double Sharp Click Medium 2 – 80%"));
}
if (effect == 43) {
Serial.println(F("43 − Long Double Sharp Click Medium 3 – 60%"));
}
if (effect == 44) {
Serial.println(F("44 − Long Double Sharp Tick 1 – 100%"));
}
if (effect == 45) {
Serial.println(F("45 − Long Double Sharp Tick 2 – 80%"));
}
if (effect == 46) {
Serial.println(F("46 − Long Double Sharp Tick 3 – 60%"));
}
if (effect == 47) {
Serial.println(F("47 − Buzz 1 – 100%"));
}
if (effect == 48) {
Serial.println(F("48 − Buzz 2 – 80%"));
}
if (effect == 49) {
Serial.println(F("49 − Buzz 3 – 60%"));
}
if (effect == 50) {
Serial.println(F("50 − Buzz 4 – 40%"));
}
if (effect == 51) {
Serial.println(F("51 − Buzz 5 – 20%"));
}
if (effect == 52) {
Serial.println(F("52 − Pulsing Strong 1 – 100%"));
}
if (effect == 53) {
Serial.println(F("53 − Pulsing Strong 2 – 60%"));
}
if (effect == 54) {
Serial.println(F("54 − Pulsing Medium 1 – 100%"));
}
if (effect == 55) {
Serial.println(F("55 − Pulsing Medium 2 – 60%"));
}
if (effect == 56) {
Serial.println(F("56 − Pulsing Sharp 1 – 100%"));
}
if (effect == 57) {
Serial.println(F("57 − Pulsing Sharp 2 – 60%"));
}
if (effect == 58) {
Serial.println(F("58 − Transition Click 1 – 100%"));
}
if (effect == 59) {
Serial.println(F("59 − Transition Click 2 – 80%"));
}
if (effect == 60) {
Serial.println(F("60 − Transition Click 3 – 60%"));
}
if (effect == 61) {
Serial.println(F("61 − Transition Click 4 – 40%"));
}
if (effect == 62) {
Serial.println(F("62 − Transition Click 5 – 20%"));
}
if (effect == 63) {
Serial.println(F("63 − Transition Click 6 – 10%"));
}
if (effect == 64) {
Serial.println(F("64 − Transition Hum 1 – 100%"));
}
if (effect == 65) {
Serial.println(F("65 − Transition Hum 2 – 80%"));
}
if (effect == 66) {
Serial.println(F("66 − Transition Hum 3 – 60%"));
}
if (effect == 67) {
Serial.println(F("67 − Transition Hum 4 – 40%"));
}
if (effect == 68) {
Serial.println(F("68 − Transition Hum 5 – 20%"));
}
if (effect == 69) {
Serial.println(F("69 − Transition Hum 6 – 10%"));
}
if (effect == 70) {
Serial.println(F("70 − Transition Ramp Down Long Smooth 1 – 100 to 0%"));
}
if (effect == 71) {
Serial.println(F("71 − Transition Ramp Down Long Smooth 2 – 100 to 0%"));
}
if (effect == 72) {
Serial.println(F("72 − Transition Ramp Down Medium Smooth 1 – 100 to 0%"));
}
if (effect == 73) {
Serial.println(F("73 − Transition Ramp Down Medium Smooth 2 – 100 to 0%"));
}
if (effect == 74) {
Serial.println(F("74 − Transition Ramp Down Short Smooth 1 – 100 to 0%"));
}
if (effect == 75) {
Serial.println(F("75 − Transition Ramp Down Short Smooth 2 – 100 to 0%"));
}
if (effect == 76) {
Serial.println(F("76 − Transition Ramp Down Long Sharp 1 – 100 to 0%"));
}
if (effect == 77) {
Serial.println(F("77 − Transition Ramp Down Long Sharp 2 – 100 to 0%"));
}
if (effect == 78) {
Serial.println(F("78 − Transition Ramp Down Medium Sharp 1 – 100 to 0%"));
}
if (effect == 79) {
Serial.println(F("79 − Transition Ramp Down Medium Sharp 2 – 100 to 0%"));
}
if (effect == 80) {
Serial.println(F("80 − Transition Ramp Down Short Sharp 1 – 100 to 0%"));
}
if (effect == 81) {
Serial.println(F("81 − Transition Ramp Down Short Sharp 2 – 100 to 0%"));
}
if (effect == 82) {
Serial.println(F("82 − Transition Ramp Up Long Smooth 1 – 0 to 100%"));
}
if (effect == 83) {
Serial.println(F("83 − Transition Ramp Up Long Smooth 2 – 0 to 100%"));
}
if (effect == 84) {
Serial.println(F("84 − Transition Ramp Up Medium Smooth 1 – 0 to 100%"));
}
if (effect == 85) {
Serial.println(F("85 − Transition Ramp Up Medium Smooth 2 – 0 to 100%"));
}
if (effect == 86) {
Serial.println(F("86 − Transition Ramp Up Short Smooth 1 – 0 to 100%"));
}
if (effect == 87) {
Serial.println(F("87 − Transition Ramp Up Short Smooth 2 – 0 to 100%"));
}
if (effect == 88) {
Serial.println(F("88 − Transition Ramp Up Long Sharp 1 – 0 to 100%"));
}
if (effect == 89) {
Serial.println(F("89 − Transition Ramp Up Long Sharp 2 – 0 to 100%"));
}
if (effect == 90) {
Serial.println(F("90 − Transition Ramp Up Medium Sharp 1 – 0 to 100%"));
}
if (effect == 91) {
Serial.println(F("91 − Transition Ramp Up Medium Sharp 2 – 0 to 100%"));
}
if (effect == 92) {
Serial.println(F("92 − Transition Ramp Up Short Sharp 1 – 0 to 100%"));
}
if (effect == 93) {
Serial.println(F("93 − Transition Ramp Up Short Sharp 2 – 0 to 100%"));
}
if (effect == 94) {
Serial.println(F("94 − Transition Ramp Down Long Smooth 1 – 50 to 0%"));
}
if (effect == 95) {
Serial.println(F("95 − Transition Ramp Down Long Smooth 2 – 50 to 0%"));
}
if (effect == 96) {
Serial.println(F("96 − Transition Ramp Down Medium Smooth 1 – 50 to 0%"));
}
if (effect == 97) {
Serial.println(F("97 − Transition Ramp Down Medium Smooth 2 – 50 to 0%"));
}
if (effect == 98) {
Serial.println(F("98 − Transition Ramp Down Short Smooth 1 – 50 to 0%"));
}
if (effect == 99) {
Serial.println(F("99 − Transition Ramp Down Short Smooth 2 – 50 to 0%"));
}
if (effect == 100) {
Serial.println(F("100 − Transition Ramp Down Long Sharp 1 – 50 to 0%"));
}
if (effect == 101) {
Serial.println(F("101 − Transition Ramp Down Long Sharp 2 – 50 to 0%"));
}
if (effect == 102) {
Serial.println(F("102 − Transition Ramp Down Medium Sharp 1 – 50 to 0%"));
}
if (effect == 103) {
Serial.println(F("103 − Transition Ramp Down Medium Sharp 2 – 50 to 0%"));
}
if (effect == 104) {
Serial.println(F("104 − Transition Ramp Down Short Sharp 1 – 50 to 0%"));
}
if (effect == 105) {
Serial.println(F("105 − Transition Ramp Down Short Sharp 2 – 50 to 0%"));
}
if (effect == 106) {
Serial.println(F("106 − Transition Ramp Up Long Smooth 1 – 0 to 50%"));
}
if (effect == 107) {
Serial.println(F("107 − Transition Ramp Up Long Smooth 2 – 0 to 50%"));
}
if (effect == 108) {
Serial.println(F("108 − Transition Ramp Up Medium Smooth 1 – 0 to 50%"));
}
if (effect == 109) {
Serial.println(F("109 − Transition Ramp Up Medium Smooth 2 – 0 to 50%"));
}
if (effect == 110) {
Serial.println(F("110 − Transition Ramp Up Short Smooth 1 – 0 to 50%"));
}
if (effect == 111) {
Serial.println(F("111 − Transition Ramp Up Short Smooth 2 – 0 to 50%"));
}
if (effect == 112) {
Serial.println(F("112 − Transition Ramp Up Long Sharp 1 – 0 to 50%"));
}
if (effect == 113) {
Serial.println(F("113 − Transition Ramp Up Long Sharp 2 – 0 to 50%"));
}
if (effect == 114) {
Serial.println(F("114 − Transition Ramp Up Medium Sharp 1 – 0 to 50%"));
}
if (effect == 115) {
Serial.println(F("115 − Transition Ramp Up Medium Sharp 2 – 0 to 50%"));
}
if (effect == 116) {
Serial.println(F("116 − Transition Ramp Up Short Sharp 1 – 0 to 50%"));
}
if (effect == 117) {
Serial.println(F("117 − Transition Ramp Up Short Sharp 2 – 0 to 50%"));
}
if (effect == 118) {
Serial.println(F("118 − Long buzz for programmatic stopping – 100%"));
}
if (effect == 119) {
Serial.println(F("119 − Smooth Hum 1 (No kick or brake pulse) – 50%"));
}
if (effect == 120) {
Serial.println(F("120 − Smooth Hum 2 (No kick or brake pulse) – 40%"));
}
if (effect == 121) {
Serial.println(F("121 − Smooth Hum 3 (No kick or brake pulse) – 30%"));
}
if (effect == 122) {
Serial.println(F("122 − Smooth Hum 4 (No kick or brake pulse) – 20%"));
}
if (effect == 123) {
Serial.println(F("123 − Smooth Hum 5 (No kick or brake pulse) – 10%"));
}

// set the effect to play
drv.setWaveform(0, effect); // play effect
drv.setWaveform(1, 0); // end waveform

// play the effect!
drv.go();

// wait a bit
delay(500);

effect++;
if (effect > 117) effect = 1;
}`

Redefinition of class Adafruit_DRV2605

Adding

#include "Adafruit_DRV2605.h"

in multiple different header files in an Arduino project results in a class redefinition error for Adafruit_DRV2605.

The Adafruit_DRV2605 header file needs

#pragma once

OR

#ifndef _ADAFRUIT_DRV2605_H
#define _ADAFRUIT_DRV2605_H

at the top of the file.

Is there a example code for auto-calibration?

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

How to make ramps effect from a current value1 to another value2

Hi, i have been reading the list of waveform effects but i did not find a kind of effect with this condition steps as follows:

  • I have a value1 [0-255]
  • I set that value1 to the haptic controller
  • I have a value2 [0-255]
  • I would like to make a ramp effect from last value1 set, to the value2

So, how could i reach this kind of ramp with this lib? Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.