Mini Fan Unit

via M5Stack
$6.57
SKU M5-U063
Description

FAN is designed with an N20 Motor and a small fan piece is included in the package. This N20 motor is has a 5V supply voltage. The output shaft has a rotational speed of 8800 RPM.




 

Product Features

  • single-direction rotation
  • 5V-DC
  • Simple DC motor with no gear
  • 60 mm mini fan paddle

Include

  • 1x FAN unit
  • 1x GROVE Cable
  • 2x Plastic fan paddle

Application

  • Electric Fan
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);

}