PinMode()
來自ALSROBOT WiKi
void pinMode (uint8_t pin, uint8_t mode)
</pre>
設(shè)置引腳模式
配置引腳為輸出或輸出模式.
參數(shù):
- 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 }
注解:
- 模擬引腳也可以當(dāng)作數(shù)字引腳使用, 編號為14(對應(yīng)模擬引腳0)到19(對應(yīng)模擬引腳5).