Description
Vibrator Motor is consist of an N20 Motor and a metal eccentric wheel.
This N20 motor is has a 5V supply voltage. The output shaft has a rotational speed of 8800 RPM. Specifications can be seen below. With this product, you can implement a vibration function to your application.
These days miniature vibrating motors are used in a wide range of products, not just phone and consumer electronics, but also included such as tools, scanners, medical instruments, GPS trackers, and control sticks. Vibrator motors are also the main actuators for haptic feedback which is an inexpensive way to increase a product’s value and differentiate it from the competition.
Product Features
- single-direction rotation
Include
- 1x VIBRATOR MOTOR unit
- 1x GROVE Cable
Application
- Vibration message functions
Learn
Code
1. Arduino IDE
To get complete code, please click here.
#include <M5Stack.h>
const int motor_pin = 21;
int freq = 10000;
int ledChannel = 0;
int resolution = 10;
void setup() {
// put your setup code here, to run once:
M5.begin();
M5.Lcd.setCursor(120, 110, 4);
M5.Lcd.println("MOTOR");
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(motor_pin, ledChannel);
}
// 0 - 1024
void loop() {
// put your main code here, to run repeatedly:
ledcWrite(ledChannel, 512);//0°
delay(1000);
ledcWrite(ledChannel, 0);//90°
delay(1000);
//ledcWrite(ledChannel, 30);//180°
//delay(1000);
}