“Sensor-LED/zh”的版本间的差异
第57行: | 第57行: | ||
} | } | ||
void loop() { | void loop() { | ||
− | digitalWrite( | + | digitalWrite(LED , HIGH); //亮灯 |
delay(500); | delay(500); | ||
− | digitalWrite( | + | digitalWrite(LED , LOW); //灭灯 |
delay(500); | delay(500); | ||
+ | } | ||
+ | </source> | ||
+ | *该例程效果为:调节亮度LED灯呼吸效果 | ||
+ | **核心Core只能用3,5,6,9,10,11引脚 | ||
+ | **核心Core+只能用7,8,9,10,12,13引脚 | ||
+ | **核心CoreUSB只能用SCL,3,4,5,6,7,8,9引脚 | ||
+ | **核心CoreRF只能用4,5,6,7,8,9,10引脚 | ||
+ | <source lang="cpp"> | ||
+ | #define LED 3 //定义LED引脚 | ||
+ | |||
+ | void setup() { | ||
+ | pinMode(LED, OUTPUT); | ||
+ | } | ||
+ | void loop() { | ||
+ | //逐渐变亮 | ||
+ | for (int8_t i = 0; i < 255; i++) { | ||
+ | analogWrite(LED, i); | ||
+ | delay(5); | ||
+ | } | ||
+ | //逐渐变暗 | ||
+ | for (int8_t i = 255; i > 0; i--) { | ||
+ | analogWrite(LED, i); | ||
+ | delay(5); | ||
+ | } | ||
} | } | ||
</source> | </source> |
2017年12月18日 (一) 07:00的版本
| |
|
技术规格
引脚
编程手册 您可以通过Getting Started了解使用Arduino IDE编程控制模块。
#define LED 8 //定义LED引脚
void setup() {
pinMode(LED,OUTPUT);
}
void loop() {
digitalWrite(LED , HIGH); //亮灯
delay(500);
digitalWrite(LED , LOW); //灭灯
delay(500);
}
#define LED 3 //定义LED引脚
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
//逐渐变亮
for (int8_t i = 0; i < 255; i++) {
analogWrite(LED, i);
delay(5);
}
//逐渐变暗
for (int8_t i = 255; i > 0; i--) {
analogWrite(LED, i);
delay(5);
}
}
文档
注意事项
示例教程
Q&A
历史
图库 |