Created
March 15, 2019 16:50
-
-
Save giantmolecules/d07d6ac27e36d2f2636ae519fe001280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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