Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. // This #include statement was automatically added by the Particle IDE.
  2. #include <adafruit-drv2605-photon.h>
  3. Adafruit_DRV2605 drv;
  4.  
  5. void setup() {
  6. Serial.begin(9600);
  7. Serial.println("DRV test");
  8. drv.begin();
  9.  
  10. drv.selectLibrary(1);
  11.  
  12. // I2C trigger by sending 'go' command
  13. // default, internal trigger when sending GO command
  14. drv.setMode(DRV2605_MODE_INTTRIG);
  15. }
  16.  
  17. uint8_t effect = 1;
  18.  
  19. void loop() {
  20. Serial.print("Effect #"); Serial.println(effect);
  21.  
  22. // set the effect to play
  23. drv.setWaveform(0, effect); // play effect
  24. drv.setWaveform(1, 0); // end waveform
  25.  
  26. // play the effect!
  27. drv.go();
  28.  
  29. // wait a bit
  30. delay(1000);
  31.  
  32. effect++;
  33. if (effect > 117) effect = 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement