#include <Wire.h> // For using I2C communication
#include "Adafruit_DRV2605.h" // For interfacing with the DRV2605 chip
#include <Wireling.h>
Adafruit_DRV2605 drv; // The variable used to interface with the DRV2605 chip
// Make Serial Monitor compatible for all TinyCircuits processors
#if defined(ARDUINO_ARCH_AVR)
#define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB
#endif
void setup() {
// Initialize and power wireling
Wireling.begin();
//The port is the number on the Adapter board where the sensor is attached
Wireling.selectPort(0);
SerialMonitorInterface.begin(9600);
SerialMonitorInterface.println("LRA Audio to Vibrate");
drv.begin();
drv.setMode(DRV2605_MODE_AUDIOVIBE);
drv.useLRA();
// ac coupled input, puts in 0.9V bias
drv.writeRegister8(DRV2605_REG_CONTROL1, 0x20);
// analog input
drv.writeRegister8(DRV2605_REG_CONTROL3, 0xA3);
drv.writeRegister8(DRV2605_REG_AUDIOLVL, 0xA5);
drv.writeRegister8(DRV2605_REG_AUDIOMAX, 0xC8);
drv.writeRegister8(DRV2605_REG_AUDIOOUTMIN, 0xFF);
drv.writeRegister8(DRV2605_REG_AUDIOOUTMAX, 0xFF);
}
void loop() {
}