From 6043fb90b8fd3fbb47e2e13346d5ef32d4875b75 Mon Sep 17 00:00:00 2001 From: HalfSweet Date: Thu, 28 Dec 2023 09:39:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9GPIO=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BE=8B=E5=AD=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/library/gpio.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/library/gpio.md b/docs/library/gpio.md index 74cb5f2..4193323 100644 --- a/docs/library/gpio.md +++ b/docs/library/gpio.md @@ -116,21 +116,22 @@ void detachInterrupt(uint32_t channel) ### GPIO 输入和输出模式 ```cpp -const auto LED = PB0; +const auto ledPin = PB0; const auto BUTTON = PF4; uint8_t stateLED = 0; void setup() { - pinMode(LED, OUTPUT); + pinMode(ledPin, OUTPUT); pinMode(BUTTON,INPUT_PULLUP); } void loop() { - if(!digitalRead(BUTTON)){ - stateLED = stateLED^1; - digitalWrite(LED,stateLED); - } + if(!digitalRead(BUTTON)) + { + stateLED = stateLED^1; + digitalWrite(ledPin,stateLED); + } } ```