Browse Source

Build class

master
Elis Axelsson 5 years ago
parent
commit
b970bf94d3
  1. 1
      Makefile
  2. 16
      code/table.py

1
Makefile

@ -3,6 +3,7 @@ copy:
ampy --port /dev/ttyUSB0 put code/main.py
ampy --port /dev/ttyUSB0 put code/pinouts.py
ampy --port /dev/ttyUSB0 put code/hcsr04.py
ampy --port /dev/ttyUSB0 put code/table.py
connect:
picocom /dev/ttyUSB0 -b115200

16
code/table.py

@ -0,0 +1,16 @@
from pinouts import NodeMCU as pins
from hcsr04 import HCSR04
import machine
class Table:
def __init__(self):
# Distance sensor
self.hcsr04 = HCSR04(trigger_pin=pins.D2, echo_pin=pins.D3)
# Movement sensor
self.movement_sensor = machine.Pin(pins.D4, mode=machine.Pin.IN)
# Relay to move up and down
self.relay_up = machine.Pin(pins.D5, mode=machine.Pin.OUT)
self.relay_down = machine.Pin(pins.D6, mode=machine.Pin.OUT)
Loading…
Cancel
Save