forked frommicropython/micropython-esp32-ulp
- Notifications
You must be signed in to change notification settings - Fork0
Commitc165035
committed
Fix blink example by correctly toggling output
The blink example was incorrect (as pointed out in issuemicropython#78).The example was toggling the GPIOs "output enable" state,instead of keeping "output enable" on and then toggling theoutput value of the pin.It "accidentally" worked, because we initally set the outputvalue to 1 (high) and thus, whenever "output enable" was set,the LED lit up, and when "output enable" was turned off, thepin was left floating without any output voltage and the LEDtherefore turned off.The new approach correctly enables "output enable" at thestart, and then only toggles the output value of the pin onand off.This change was also tested with a logic analyser, showingthat before this change, the logic analyser could not correclydetect a LOW state after a HIGH state, because the pin wasfloating without a pull-down resistor in place, whenever itwas not in "output enable" mode.After this change, the logic analyser correctly detected allLOW and HIGH states, because the pin remained in "outputenable" mode (and the ESP32 has a pull-down configured bydefault) and only the output value was toggled.1 parent8fa7070 commitc165035
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
Comments
(0)