Flora, Haptic motor and variation

Wearable electronics: boards, conductive materials, and projects from Adafruit!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
robbarrett
 
Posts: 1
Joined: Mon Dec 04, 2017 12:23 am

Flora, Haptic motor and variation

Post by robbarrett »

So I'm trying to have my Flora, my Adafruit DRV2605 and my haptic motor vibrate constantly, and rise and fall in intensity slowly over time. I have the main 4 wires soldered (GND, SCL#3, SDA#2, 3.3V) plus the pin 10 from the flora to the in of the Adafruit DRV2605 wired. It currently vibrates constantly but doesn't change intensity. Here's the code I'm using:

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

Adafruit_DRV2605 drv;

void setup() {
drv.begin();
pinMode(10, OUTPUT);

drv.setMode(DRV2605_MODE_AUDIOVIBE);

// ac coupled input, puts in 0.9V bias
drv.writeRegister8(DRV2605_REG_CONTROL1, 0x20);

// analog input
drv.writeRegister8(DRV2605_REG_CONTROL3, 0xA3);
}

void loop() {
for (short int i=0; i<=255; i++)
{
analogWrite(10, i);
delay(3);
}


for (short int i=255; i>0; i--)
{
analogWrite(10, i);
delay(3);
}



}
Any idea on how to get it to ramp up and then down repeatedly slowly, like 3 seconds up and then 3 secs down and then back again.

Thanks
Rob Barrett, Jr.
Eden Prairie, MN

User avatar
caitlinsdad
 
Posts: 627
Joined: Fri Feb 24, 2012 4:23 pm

Re: Flora, Haptic motor and variation

Post by caitlinsdad »

Take a look at the guide https://learn.adafruit.com/adafruit-drv ... t?view=all
You might have to go to the sample code on how to implement the different waveforms or modes. Good luck.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wearables”