“(SKU:ELB060415)3路MOS管场效应管驱动模块 IRF540”的版本间的差异

来自YwRobot Studio Wiki
跳转至: 导航搜索
(创建页面,内容为“image:3MOS.jpg ==简介== 采用原装IRF540功率MOS管,可以进行PWM调节输出 可以让Arduino驱动高达24V的负载,如LED灯...”)
 
样例代码2
 
(未显示2个用户的3个中间版本)
第23行: 第23行:
 
==使用教程==
 
==使用教程==
 
[[File:3MOSLINE.jpg|1000px|]]
 
[[File:3MOSLINE.jpg|1000px|]]
 +
[[File:3MOS1LINE.jpg|1050px|]]
  
===样例代码===
+
===样例代码1===
 
<pre style="color:blue">
 
<pre style="color:blue">
 +
int led1 = 9;
 +
int led2 = 10;
 +
int led3 = 11;
  
 +
void setup() {
 +
  pinMode(led1, OUTPUT);
 +
  pinMode(led2, OUTPUT);
 +
  pinMode(led3, OUTPUT);
 +
}
 +
 +
void loop() {
 +
  digitalWrite(led1, HIGH); 
 +
  delay(1000);             
 +
  digitalWrite(led1, LOW);
 +
  digitalWrite(led2, HIGH);
 +
  delay(1000);
 +
  digitalWrite(led2, LOW); 
 +
  digitalWrite(led3, HIGH);
 +
  delay(1000);
 +
  digitalWrite(led3, LOW); 
 +
}
 +
</pre>
 +
 +
===样例代码2===
 +
<pre style="color:blue">
 +
#define LEDR 9
 +
#define LEDB 11
 +
#define LEDG 10
 +
int i = 0;
 +
 +
void setup() {
 +
  pinMode(LEDG, OUTPUT);
 +
  pinMode(LEDB, OUTPUT);
 +
  pinMode(LEDR, OUTPUT);
 +
}
 +
 +
void loop() {
 +
  analogWrite(LEDR, 255);
 +
  analogWrite(LEDB, 255);
 +
  analogWrite(LEDG, 255); //off
 +
  analogWrite(LEDR, 0);
 +
  delay(1000);    //hong
 +
  analogWrite(LEDG, 220);
 +
  delay(1000);  //cheng
 +
  analogWrite(LEDR, 0);
 +
  analogWrite(LEDG, 120);
 +
  delay(1000);  //huang
 +
  analogWrite(LEDR, 255);
 +
  analogWrite(LEDG, 0);
 +
  delay(1000);  //lv
 +
  analogWrite(LEDB, 0);
 +
  delay(1000);  //qing
 +
  analogWrite(LEDG, 255);
 +
  analogWrite(LEDB, 0);
 +
  delay(1000);  //lan
 +
  analogWrite(LEDR, 0);
 +
  analogWrite(LEDG, 255);
 +
  delay(1000);  //zi
 +
  analogWrite(LEDG, 0);
 +
  delay(1000);  //bai
 +
 +
  analogWrite(LEDR, 255);
 +
  analogWrite(LEDB, 255);
 +
  analogWrite(LEDG, 255); //off
 +
 +
  for (i = 255; i > 0; i--) {
 +
    analogWrite(LEDR, i);
 +
    delay(10);
 +
  }
 +
  for (i = 255; i > 0; i--) {
 +
    analogWrite(LEDG, i);
 +
    delay(10);
 +
  }
 +
  for (i = 0; i < 255; i++) {
 +
    analogWrite(LEDR, i);
 +
    delay(10);
 +
  }
 +
  for (i = 255; i > 0; i--) {
 +
    analogWrite(LEDB, i);
 +
    delay(10);
 +
  }
 +
  for (i = 0; i < 255; i++) {
 +
    analogWrite(LEDG, i);
 +
    delay(10);
 +
  }
 +
  for (i = 255; i > 0; i--) {
 +
    analogWrite(LEDR, i);
 +
    delay(10);
 +
  }
 +
  analogWrite(LEDG, 0);
 +
  analogWrite(LEDB, 0);
 +
  analogWrite(LEDR, 0);
 +
}
 
</pre>
 
</pre>
  

2017年1月11日 (三) 16:08的最新版本

3MOS.jpg

简介

采用原装IRF540功率MOS管,可以进行PWM调节输出 可以让Arduino驱动高达24V的负载,如LED灯带、直流马达、微型水泵、电磁阀 用过PWM调可以实现LED无级调光、马达无级调速。

注意:驱动1A以上的负载需安装散热片

产品参数

  • 尺寸:69.4*41.7mm
  • 固定孔:3mm
  • 孔距:2400*1300mil(60.96*33.02mm)
  • 电压:3.3V、5V
  • 端口:数字量电平
  • 输出负载电压:0-24V
  • 输出负载电流:<6A (1A以上需加散热片)
  • 平台:Arduino、单片机、ARM、树莓派

使用教程

3MOSLINE.jpg 3MOS1LINE.jpg

样例代码1

int led1 = 9;
int led2 = 10;
int led3 = 11;

void setup() {
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
}

void loop() {
  digitalWrite(led1, HIGH);  
  delay(1000);              
  digitalWrite(led1, LOW);
  digitalWrite(led2, HIGH); 
  delay(1000);
  digitalWrite(led2, LOW);  
  digitalWrite(led3, HIGH); 
  delay(1000);
  digitalWrite(led3, LOW);  
}

样例代码2

#define LEDR 9
#define LEDB 11
#define LEDG 10
int i = 0;

void setup() {
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
  pinMode(LEDR, OUTPUT);
}

void loop() {
  analogWrite(LEDR, 255);
  analogWrite(LEDB, 255);
  analogWrite(LEDG, 255); //off
  analogWrite(LEDR, 0);
  delay(1000);    //hong
  analogWrite(LEDG, 220);
  delay(1000);   //cheng
  analogWrite(LEDR, 0);
  analogWrite(LEDG, 120);
  delay(1000);   //huang
  analogWrite(LEDR, 255);
  analogWrite(LEDG, 0);
  delay(1000);   //lv
  analogWrite(LEDB, 0);
  delay(1000);   //qing
  analogWrite(LEDG, 255);
  analogWrite(LEDB, 0);
  delay(1000);   //lan
  analogWrite(LEDR, 0);
  analogWrite(LEDG, 255);
  delay(1000);   //zi
  analogWrite(LEDG, 0);
  delay(1000);   //bai

  analogWrite(LEDR, 255);
  analogWrite(LEDB, 255);
  analogWrite(LEDG, 255); //off

  for (i = 255; i > 0; i--) {
    analogWrite(LEDR, i);
    delay(10);
  }
  for (i = 255; i > 0; i--) {
    analogWrite(LEDG, i);
    delay(10);
  }
  for (i = 0; i < 255; i++) {
    analogWrite(LEDR, i);
    delay(10);
  }
  for (i = 255; i > 0; i--) {
    analogWrite(LEDB, i);
    delay(10);
  }
  for (i = 0; i < 255; i++) {
    analogWrite(LEDG, i);
    delay(10);
  }
  for (i = 255; i > 0; i--) {
    analogWrite(LEDR, i);
    delay(10);
  }
  analogWrite(LEDG, 0);
  analogWrite(LEDB, 0);
  analogWrite(LEDR, 0);
}

更多

[YWRobot产品资料下载]

购买 YWRobot商城购买链接