Upload the following code to your Flora using the Arduino IDE. Change the 'interval' variable to your desired timer. Requires the DRV2605 library.

This basic code creates a variable delay between pulses-- adjust the 'interval' value to your liking.

For a more complex, power saving example, check out the Gemma Mindfulness Bracelet.

Download: file
/*
Basic timer circuit to trigger haptic motor controller at a specified interval.
Uses Flora and DRV2605L Haptic Motor Controller
Tutorial: https://learn.adafruit.com/haptic-headband
*/

#include <Wire.h>
#include "Adafruit_DRV2605.h"

Adafruit_DRV2605 drv;

uint8_t effect = 7;
uint32_t wait = 10; // Time between reminders, in seconds

void setup() {
  Serial.begin(9600);
  drv.begin();
  
  drv.selectLibrary(1);
  
  // I2C trigger by sending 'go' command 
  // default, internal trigger when sending GO command
  drv.setMode(DRV2605_MODE_INTTRIG); 
  
}

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();
    
    
    delay(wait * 60 * 1000);
    

}
This guide was first published on Nov 25, 2015. It was last updated on Nov 25, 2015. This page (Code) was last updated on Jun 21, 2019.