|
|
|
@ -1,18 +1,17 @@
|
|
|
|
|
* Setup
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
|
nix-shell --command fish
|
|
|
|
|
virtualenv --no-site-packages --distribute .env
|
|
|
|
|
source .env/bin/activate
|
|
|
|
|
source .env/bin/activate.fish
|
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
* Connect to serial port
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
|
picocom /dev/ttyUSB0 -b115200
|
|
|
|
|
#+END_SRC
|
|
|
|
|
# Copy files
|
|
|
|
|
make copy
|
|
|
|
|
|
|
|
|
|
* Copying file
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
|
ampy --port /dev/ttyUSB0 put hcsr04.py
|
|
|
|
|
# Connect to serial port
|
|
|
|
|
make connect
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
* How to connect things
|
|
|
|
@ -27,10 +26,12 @@ ampy --port /dev/ttyUSB0 put hcsr04.py
|
|
|
|
|
|
|
|
|
|
*** Set up distance measuring
|
|
|
|
|
#+begin_src python
|
|
|
|
|
import time
|
|
|
|
|
from table import Table
|
|
|
|
|
|
|
|
|
|
table = Table()
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
print(getDistance())
|
|
|
|
|
print(table.currentHeight())
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
@ -44,10 +45,12 @@ while True:
|
|
|
|
|
|
|
|
|
|
*** Set up movement sensor
|
|
|
|
|
#+begin_src python
|
|
|
|
|
import time
|
|
|
|
|
from table import Table
|
|
|
|
|
|
|
|
|
|
table = Table()
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
print(getMovement())
|
|
|
|
|
print(table.getMovement())
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
@ -62,15 +65,20 @@ while True:
|
|
|
|
|
|
|
|
|
|
*** Set up relays
|
|
|
|
|
#+begin_src python
|
|
|
|
|
# Use this to reset the state of the relay
|
|
|
|
|
resetRelay()
|
|
|
|
|
from table import Table
|
|
|
|
|
|
|
|
|
|
table = Table()
|
|
|
|
|
|
|
|
|
|
# Reset relays
|
|
|
|
|
table.move(0)
|
|
|
|
|
|
|
|
|
|
# Move table up
|
|
|
|
|
toggleRaiseUp()
|
|
|
|
|
table.move(1)
|
|
|
|
|
|
|
|
|
|
# Move table down
|
|
|
|
|
toggleLowerDown()
|
|
|
|
|
table.move(-1)
|
|
|
|
|
|
|
|
|
|
# To go up and down and measure distance and stuff at the same time
|
|
|
|
|
goCrazy()
|
|
|
|
|
import main
|
|
|
|
|
main.goCrazy()
|
|
|
|
|
#+end_src
|
|
|
|
|