Add crazy code and docs

master
Elis Axelsson 2017-08-17 23:02:54 +02:00
parent b6de0dc4ef
commit d3edd355dc
2 changed files with 39 additions and 0 deletions

View File

@ -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

View File

@ -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()