Skip to content

Commit

Permalink
fix: 修改GPIO中的例子错误
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfSweet committed Dec 28, 2023
1 parent 5799563 commit 6043fb9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions docs/library/gpio.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
```

Expand Down

0 comments on commit 6043fb9

Please sign in to comment.