// Tactile3.ino // // Gerard Paresys // 3 9 2023 // // Utilise la library Adafruit_DRV2605 // Utilise la library Adafruit BusIO // // OK Arduino UNO + ADAFRUIT DRV2605L // OK Adafruit Feather M0 Radio + ADAFRUIT DRV2605L #include #include "Adafruit_DRV2605.h" Adafruit_DRV2605 drv; void setup() { Serial.begin(9600); Serial.println("Adafruit DRV2605 Basic test"); if (! drv.begin()) { Serial.println("Could not find DRV2605"); while (1) delay(10); } drv.selectLibrary(6); // 0 = Empty, 1-5 are ERM, 6 is LRA // I2C trigger by sending 'go' command drv.setMode(DRV2605_MODE_INTTRIG); // default, internal trigger when sending GO command // drv.useERM(); // Use ERM (Eccentric Rotating Mass) mode. drv.useLRA(); // Use LRA (Linear Resonance Actuator) mode. } uint8_t effect = 1; int Compteur = 1; void loop() { // Serial.print("Effect #"); Serial.println(effect); if (Compteur == 1) { Serial.println("11.2 Waveform Library Effects List"); } if (Compteur == 1) { effect = 1; Serial.println(F("1 − Strong Click - 100%")); } if (Compteur == 2) { effect = 7; Serial.println(F("7 − Soft Bump - 100%")); } if (Compteur == 3) { effect = 14; Serial.println(F("14 − Strong Buzz - 100%")); } if (Compteur == 4) { effect = 15; Serial.println(F("15 − 750 ms Alert 100%")); } if (Compteur == 5) { effect = 16; Serial.println(F("16 − 1000 ms Alert 100%")); } if (Compteur == 6) { effect = 47; Serial.println(F("47 − Buzz 1 – 100%")); } if (Compteur == 7) { effect = 58; Serial.println(F("58 − Transition Click 1 – 100%")); } if (Compteur == 8) { effect = 82; Serial.println(F("82 − Transition Ramp Up Long Smooth 1 – 0 to 100%")); } if (Compteur == 9) { effect = 86; Serial.println(F("86 − Transition Ramp Up Short Smooth 1 – 0 to 100%")); } if (Compteur == 10) { effect = 92; Serial.println(F("92 − Transition Ramp Up Short Sharp 1 – 0 to 100%")); } if (Compteur == 11) { effect = 118; Serial.println(F("118 − Long buzz for programmatic stopping – 100%")); } if (Compteur == 12) { delay(10000); effect = 119; Serial.println(F("119 − Smooth Hum 1 (No kick or brake pulse) – 50%")); } drv.setWaveform(0, effect); // set the effect to play drv.setWaveform(1, 0); // end waveform drv.go(); // play the effect! delay(3000); // wait 3 seconds Compteur++; if (Compteur > 12) Compteur = 1; }