Hello,
I have this code that is working perfectly but I want my device to start vibrating too (right now only the led is working)
On a Wemos Battery Module I have simply connected the vibration motor on the same PIN of the LED and it works perfectly.
Now I want to do the same on an Beetle ESP32 Microcontroller DFR0575. I used the same code But I can't make the module vibrating (The led is working perfectly)
THE CODE
#include <BLEAdvertisedDevice.h>
#include <BLEDevice.h>
#include <BLEScan.h>
const int PIN = 2;
const int CUTOFF = -50;
void setup() {
pinMode(PIN, OUTPUT);
BLEDevice::init("tkr");
}
void loop() {
BLEScan *scan = BLEDevice::getScan();
scan->setActiveScan(true);
BLEScanResults results = scan->start(1);
int best = CUTOFF;
for (int i = 0; i < results.getCount(); i++) {
BLEAdvertisedDevice device = results.getDevice(i);
int rssi = device.getRSSI();
if (rssi > best) {
best = rssi;
}
}
digitalWrite(PIN, best > CUTOFF ? HIGH : LOW);
}