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