|
|
|
@ -27,10 +27,10 @@ ampy --port /dev/ttyUSB0 put hcsr04.py
|
|
|
|
|
|
|
|
|
|
*** Set up distance measuring
|
|
|
|
|
#+begin_src python
|
|
|
|
|
import main, time
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
print(main.getDistance())
|
|
|
|
|
print(getDistance())
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
@ -44,10 +44,10 @@ while True:
|
|
|
|
|
|
|
|
|
|
*** Set up movement sensor
|
|
|
|
|
#+begin_src python
|
|
|
|
|
import main, time
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
print(main.getMovement())
|
|
|
|
|
print(getMovement())
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
@ -62,17 +62,15 @@ while True:
|
|
|
|
|
|
|
|
|
|
*** Set up relays
|
|
|
|
|
#+begin_src python
|
|
|
|
|
import main
|
|
|
|
|
|
|
|
|
|
# Use this to reset the state of the relay
|
|
|
|
|
main.resetRelay()
|
|
|
|
|
resetRelay()
|
|
|
|
|
|
|
|
|
|
# Move table up
|
|
|
|
|
main.toggleRaiseUp()
|
|
|
|
|
toggleRaiseUp()
|
|
|
|
|
|
|
|
|
|
# Move table down
|
|
|
|
|
main.toggleLowerDown()
|
|
|
|
|
toggleLowerDown()
|
|
|
|
|
|
|
|
|
|
# To go up and down and measure distance and stuff at the same time
|
|
|
|
|
main.goCrazy()
|
|
|
|
|
goCrazy()
|
|
|
|
|
#+end_src
|
|
|
|
|