You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.5 KiB

* Setup
#+BEGIN_SRC sh
nix-shell --command fish
virtualenv --no-site-packages --distribute .env
source .env/bin/activate.fish
pip install -r requirements.txt
#+END_SRC
#+BEGIN_SRC sh
# Copy files
make copy
# Connect to serial port
make connect
#+END_SRC
* How to connect things
** Distance measuring
*** HCSR04 Pins
5 years ago
| Pin on component | Pin on card |
|------------------+-------------|
| Trig | D2 |
| Echo | D3 |
5 years ago
| Vcc | 5V |
| GND | GND |
*** Set up distance measuring
#+begin_src python
from table import Table
table = Table()
while True:
print(table.currentHeight())
time.sleep(1)
#+end_src
** Movement sensor
*** Sensor pins
5 years ago
| Pin on component | Pin on card |
|------------------+-------------|
| 5V | 5V |
| GND | GND |
| OUT | D4 |
*** Set up movement sensor
#+begin_src python
from table import Table
table = Table()
while True:
print(table.getMovement())
time.sleep(0.5)
#+end_src
** Relay
*** Pins
| Pin on component | Pin on card |
|------------------+-------------|
| Vcc | 5V |
| Gnd | GND |
| In1 | D5 |
| In2 | D6 |
*** Set up relays
#+begin_src python
from table import Table
table = Table()
# Reset relays
table.move(0)
# Move table up
table.move(1)
# Move table down
table.move(-1)
# To go up and down and measure distance and stuff at the same time
import main
main.goCrazy()
#+end_src