Commit c165035
committed
Fix blink example by correctly toggling output
The blink example was incorrect (as pointed out in issue #78).
The example was toggling the GPIOs "output enable" state,
instead of keeping "output enable" on and then toggling the
output value of the pin.
It "accidentally" worked, because we initally set the output
value to 1 (high) and thus, whenever "output enable" was set,
the LED lit up, and when "output enable" was turned off, the
pin was left floating without any output voltage and the LED
therefore turned off.
The new approach correctly enables "output enable" at the
start, and then only toggles the output value of the pin on
and off.
This change was also tested with a logic analyser, showing
that before this change, the logic analyser could not correcly
detect a LOW state after a HIGH state, because the pin was
floating without a pull-down resistor in place, whenever it
was not in "output enable" mode.
After this change, the logic analyser correctly detected all
LOW and HIGH states, because the pin remained in "output
enable" mode (and the ESP32 has a pull-down configured by
default) and only the output value was toggled.1 parent 8fa7070 commit c165035
1 file changed
+6
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
| 34 | + | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
| |||
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
65 | | - | |
66 | | - | |
| 63 | + | |
| 64 | + | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
| |||
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
86 | | - | |
| 84 | + | |
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
90 | 88 | | |
91 | | - | |
| 89 | + | |
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
| |||
0 commit comments