21. Lektion: Pin's

Aus Attraktor Wiki

Wechseln zu: Navigation, Suche
  • Was biett uns die Klasse Pin?
>>> import machine
>>> dir(machine.Pin)
['__class__', '__name__', 'value', '__bases__', '__dict__', 'IN', 'IRQ_FALLING', 'IRQ_RISING', 'OPEN_DRAIN', 
'OUT', 'PULL_DOWN', 'PULL_HOLD', 'PULL_UP', 'WAKE_HIGH', 'WAKE_LOW', 'init', 'irq', 'off', 'on']
  • Pins initialisieren.
machine.Pin(id, mode=- 1, pull=- 1, *, value=None, drive=0, alt=- 1)
id
Nummer des Pin (GPIO)
mode
pull
*
value
drive
alt
  • Pins als Ausgang.
    • LED ansteuern.
  • Pins als Eingang.
    • Taster abfragen.

https://docs.m5stack.com/en/mpy/official/machine