Browse Source

Add crazy code and docs

master
Elis Axelsson 5 years ago
parent
commit
d3edd355dc
  1. 17
      README.org
  2. 22
      code/main.py

17
README.org

@ -59,3 +59,20 @@ while True:
| Gnd | GND |
| In1 | D5 |
| In2 | D6 |
*** Set up relays
#+begin_src python
import main
# Use this to reset the state of the relay
main.resetRelay()
# Move table up
main.toggleRaiseUp()
# Move table down
main.toggleLowerDown()
# To go up and down and measure distance and stuff at the same time
main.goCrazy()
#+end_src

22
code/main.py

@ -34,3 +34,25 @@ def toggleLowerDown():
relayDown = machine.Pin(pins.D6, mode=machine.Pin.OUT)
relayDown.value(not relayDown.value())
def goCrazy():
resetRelay()
while True:
print("Lowest Distance: " + str(getDistance()))
print("Movement: " + str(getMovement()))
toggleRaiseUp()
time.sleep(3)
print("Highest Distance: " + str(getDistance()))
print("Movement: " + str(getMovement()))
toggleRaiseUp()
toggleLowerDown()
time.sleep(3)
toggleLowerDown()

Loading…
Cancel
Save