“PinMode()”的版本间的差异

来自Microduino Wikipedia
跳转至: 导航搜索
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
 +
<pre style="color:green">
 
void pinMode (uint8_t pin, uint8_t mode)
 
void pinMode (uint8_t pin, uint8_t mode)
 
</pre>
 
</pre>
第7行: 第8行:
 
*'''参数''':<br>
 
*'''参数''':<br>
 
pin 引脚编号
 
pin 引脚编号
 +
 
mode: INPUT, OUTPUT, 或 INPUT_PULLUP.
 
mode: INPUT, OUTPUT, 或 INPUT_PULLUP.
  
第29行: 第31行:
 
*'''注解''':<br>
 
*'''注解''':<br>
 
模拟引脚也可以当作数字引脚使用, 编号为14(对应模拟引脚0)到19(对应模拟引脚5).
 
模拟引脚也可以当作数字引脚使用, 编号为14(对应模拟引脚0)到19(对应模拟引脚5).
 +
 +
[[https://www.microduino.cn/wiki/index.php/Arduino_%E8%AF%AD%E6%B3%95%E6%89%8B%E5%86%8C/zh 返回Arduino语法手册]]

2016年5月23日 (一) 03:15的最新版本

void pinMode (uint8_t pin, uint8_t mode)

设置引脚模式

配置引脚为输出或输出模式.

  • 参数:

pin 引脚编号

mode: INPUT, OUTPUT, 或 INPUT_PULLUP.

  • 例子:
int ledPin = 13;                 // LED connected to digital pin 13

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}
  • 注解:

模拟引脚也可以当作数字引脚使用, 编号为14(对应模拟引脚0)到19(对应模拟引脚5).

[返回Arduino语法手册]