Move movement sensor code to table class

master
Elis Axelsson 5 years ago
parent c84dd8859e
commit b94921aed1
  1. 5
      code/main.py
  2. 9
      code/table.py

@ -3,11 +3,6 @@ import time
import machine
def getMovement():
sensor = machine.Pin(pins.D4, mode=machine.Pin.IN, pull=None)
return sensor.value()
def goCrazy():
while True:
print("Lowest Distance: " + str(getDistance()))

@ -18,6 +18,7 @@ class Table:
# Reset both relays on set up
self.move(0)
def currentHeight(self):
"""
Get current height of the table in CM.
@ -31,6 +32,14 @@ class Table:
return False
def getMovement(self):
"""
Get movement from sensor.
"""
return self.movement_sensor.value()
def move(self, direction):
"""
Direction should be an integer:

Loading…
Cancel
Save