Skip to content
Discussion options

You must be logged in to vote

The names of p.on() and p.off() are misleading. A pin cannot be on of off. And whether a LED connected to a pin turns on or off depends on it's wiring. p.on() sets the pin output high, to about 3.3V. p.off() sets it low. If the LED is connected between Vcc and the Pin, it will light up with p.off()
For driving a LED better use the machine.Signal class. It has the option to set the logic to invert. Then signal.on() will turn the LED on. See https://docs.micropython.org/en/latest/library/machine.Signal.html#machine.Signal

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by konomikitten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants