Direkt zum Hauptbereich

Posts

Posts mit dem Label "Magnetic Field Logger" werden angezeigt.

Pi And More 11 - Python Pushbutton Class

As on PAM 11 in Trier introduced: Python-Logger-Class (Push Button Library) as part of the Python magnetic field logger and detector project . ######################################## # # Python Magnetic Field Logger and Detector # by Sebastian Folz # Pusbutton library - handles push buttons # Introduced on Pi And More 11 # ######################################## # import GPIO import RPi.GPIO as GPIO # enumerations from enum import Enum class Push (Enum): NONE = 0 SHORT_DOWN = 1 LONG_DOWN = 2 class pushbutton : #pushed = False def __init__ ( self ): GPIO . setmode(GPIO . BOARD) self . pushed = False self . pin = - 1 self . cycles = 0 def setLongCycle ( self , cycles): self . long_cycles = cycles; def configure ( self , aPin): self . pin = aPin GPIO . setup( self . pin, GPIO . IN, pull_up_down = GPIO . PUD_UP) def isPushed ( self ): # ...