You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Elis Axelsson c5b2ed496f Docs for my small card 6 years ago
.gitignore Ignore /.env/ dir 6 years ago
README.org Docs for my small card 6 years ago
default.nix Add deps 6 years ago
hcsr04.py Add lib 6 years ago
requirements.txt Added requirements.txt 6 years ago

README.org

Setup

virtualenv --no-site-packages --distribute .env
source .env/bin/activate
pip install -r requirements.txt

Connect to serial port

picocom /dev/ttyUSB0 -b115200

Small card

Set up distance measuring

from hcsr04 import HCSR04
import time

sensor = HCSR04(trigger_pin=16, echo_pin=0)

while True:
    print(sensor.distance_cm())
    time.sleep(1)

HCSR04 Pins

Trig D0 Echo D3 Vcc 5V GND GND