feat: added some features

This commit is contained in:
2020-05-17 19:38:08 +02:00
parent f69cc0b45c
commit 8b268ef48c
8 changed files with 425 additions and 93 deletions

42
control/mockGpio.py Normal file
View File

@@ -0,0 +1,42 @@
from typing import Optional
class GPIO:
BCM = 1
IN = 1
OUT = 2
LOW = 0
HIGH = 1
class PWM:
def __init__(self, pin, freq):
self.pin = pin
self.freq = freq
self.dc: Optional[float] = None
self.name = None
def start(self, dc: float):
self.dc = dc
def ChangeDutyCycle(self, dc):
self.dc = dc
print(f'[{self.pin}@{self.freq}Hz]{" " + self.name if self.name else ""} => {self.dc}')
def stop(self):
print("stop pwm")
@staticmethod
def setup(pin, mode):
print(f"setup {pin} -> {mode}")
@staticmethod
def output(pin, value):
print(f"output {pin} -> {value}")
@staticmethod
def setmode(mode):
print(f"setmode {mode}")
@staticmethod
def cleanup():
print("cleanup")