Skip to content

Instantly share code, notes, and snippets.

@giantmolecules
Created March 15, 2019 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giantmolecules/d07d6ac27e36d2f2636ae519fe001280 to your computer and use it in GitHub Desktop.
Save giantmolecules/d07d6ac27e36d2f2636ae519fe001280 to your computer and use it in GitHub Desktop.
// This #include statement was automatically added by the Particle IDE.
#include <adafruit-drv2605-photon.h>
Adafruit_DRV2605 drv;
void setup() {
Serial.begin(9600);
Serial.println("DRV test");
drv.begin();
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);
// 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(1000);
effect++;
if (effect > 117) effect = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment