You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Tinycircuits AST1013 LRA driver wireling with ESPWROOM32 and the LRA motor used in the AST1013 is VG0832013D, whose resonant frequency is 235 Hz. The LEDC library used in your code has updated and I made some changes accordingly.
void loop()
{
while (Serial.available())
{
int Frequency = Serial.parseInt();
uint8_t Power = Serial.parseInt();
SetFreq(Frequency);
SetMotorVoltage(Power);
while (Serial.available())
Serial.read(); //Read redundant data in buffer
}
}
`
But it is not working. I don't know what issues I am facing. I have read the datasheet of DRV2605L and I understood the theory but I am rookie for MCUs. Can you please guide me?
Thank you.
The text was updated successfully, but these errors were encountered:
I am using Tinycircuits AST1013 LRA driver wireling with ESPWROOM32 and the LRA motor used in the AST1013 is VG0832013D, whose resonant frequency is 235 Hz. The LEDC library used in your code has updated and I made some changes accordingly.
`#include <Wire.h>
#include "Adafruit_DRV2605.h"
const int Motor_PWM_Pins = 16;
const uint32_t Default_PWM_Frequency = 235;
Adafruit_DRV2605 drv;
void SetMotorVoltage(uint8_t Fraction = 0x89)
{
drv.writeRegister8(0x16, Fraction);
drv.writeRegister8(0x17, Fraction);
}
void SetFreq(uint32_t Freq = Default_PWM_Frequency)
{
//DRV2605 Input PWM Frequency: 10-250kHz
assert (Freq <= 1950); //DRV2605 cannot support > 250kHz PWM signals
assert (Freq != 0); //DRV2605 cannot support < 10Hz PWM signals
Freq *= 128;
ledcAttachChannel(16, Freq, 8, 0);
ledcWrite(16, 255);
}
void setup()
{
Serial.begin(115200);
Wire.begin();
/Setup DRV2605/
drv.begin();
drv.useLRA();
drv.setMode(DRV2605_MODE_PWMANALOG);
//LRA_OPEN_LOOP
drv.writeRegister8(DRV2605_REG_CONTROL3, drv.readRegister8(DRV2605_REG_CONTROL3) | 0x01);
/Setup DRV2605/
SetFreq(Default_PWM_Frequency);
}
void loop()
{
while (Serial.available())
{
int Frequency = Serial.parseInt();
uint8_t Power = Serial.parseInt();
SetFreq(Frequency);
SetMotorVoltage(Power);
}
}
`
But it is not working. I don't know what issues I am facing. I have read the datasheet of DRV2605L and I understood the theory but I am rookie for MCUs. Can you please guide me?
Thank you.
The text was updated successfully, but these errors were encountered: