tablecontrol/README.org

77 lines
1.5 KiB
Org Mode
Raw Normal View History

2017-07-24 17:47:30 +02:00
* Setup
#+BEGIN_SRC sh
virtualenv --no-site-packages --distribute .env
source .env/bin/activate
pip install -r requirements.txt
#+END_SRC
2017-07-24 17:50:06 +02:00
* Connect to serial port
#+BEGIN_SRC sh
2017-07-24 19:49:21 +02:00
picocom /dev/ttyUSB0 -b115200
2017-07-24 17:50:06 +02:00
#+END_SRC
2017-07-24 20:06:45 +02:00
2017-08-07 20:23:40 +02:00
* Copying file
#+BEGIN_SRC sh
ampy --port /dev/ttyUSB0 put hcsr04.py
#+END_SRC
* How to connect things
2017-08-07 20:09:29 +02:00
** Distance measuring
*** HCSR04 Pins
2017-08-11 08:28:04 +02:00
| Pin on component | Pin on card |
|------------------+-------------|
| Trig | D2 |
| Echo | D3 |
2017-08-11 08:28:04 +02:00
| Vcc | 5V |
| GND | GND |
2017-08-07 20:09:29 +02:00
*** Set up distance measuring
2017-07-24 20:06:45 +02:00
#+begin_src python
2017-08-17 23:12:52 +02:00
import time
2017-07-24 20:06:45 +02:00
while True:
2017-08-17 23:12:52 +02:00
print(getDistance())
time.sleep(1)
2017-07-24 20:06:45 +02:00
#+end_src
2017-08-07 20:09:29 +02:00
** Movement sensor
*** Sensor pins
2017-08-11 08:28:04 +02:00
| Pin on component | Pin on card |
|------------------+-------------|
| 5V | 5V |
| GND | GND |
| OUT | D4 |
2017-08-07 20:09:29 +02:00
*** Set up movement sensor
#+begin_src python
2017-08-17 23:12:52 +02:00
import time
2017-08-07 20:09:29 +02:00
while True:
2017-08-17 23:12:52 +02:00
print(getMovement())
time.sleep(0.5)
2017-08-07 20:09:29 +02:00
#+end_src
** Relay
*** Pins
| Pin on component | Pin on card |
|------------------+-------------|
| Vcc | 5V |
| Gnd | GND |
| In1 | D5 |
| In2 | D6 |
2017-08-17 23:02:54 +02:00
*** Set up relays
#+begin_src python
# Use this to reset the state of the relay
2017-08-17 23:12:52 +02:00
resetRelay()
2017-08-17 23:02:54 +02:00
# Move table up
2017-08-17 23:12:52 +02:00
toggleRaiseUp()
2017-08-17 23:02:54 +02:00
# Move table down
2017-08-17 23:12:52 +02:00
toggleLowerDown()
2017-08-17 23:02:54 +02:00
# To go up and down and measure distance and stuff at the same time
2017-08-17 23:12:52 +02:00
goCrazy()
2017-08-17 23:02:54 +02:00
#+end_src