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.
|
|
|
* Setup
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
virtualenv --no-site-packages --distribute .env
|
|
|
|
source .env/bin/activate
|
|
|
|
pip install -r requirements.txt
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Connect to serial port
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
picocom /dev/ttyUSB0 -b115200
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Copying file
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
ampy --port /dev/ttyUSB0 put hcsr04.py
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Small card
|
|
|
|
** Distance measuring
|
|
|
|
*** HCSR04 Pins
|
|
|
|
Trig -- D0
|
|
|
|
Echo -- D3
|
|
|
|
Vcc -- 5V
|
|
|
|
GND -- GND
|
|
|
|
|
|
|
|
*** Set up distance measuring
|
|
|
|
#+begin_src python
|
|
|
|
import tablecode.main
|
|
|
|
|
|
|
|
tablecode.main.distance(16, 0)
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Movement sensor
|
|
|
|
*** Sensor pins
|
|
|
|
5V -- 5V
|
|
|
|
GND -- GND
|
|
|
|
OUT -- D0
|
|
|
|
|
|
|
|
*** Set up movement sensor
|
|
|
|
#+begin_src python
|
|
|
|
import machine
|
|
|
|
|
|
|
|
pin = machine.Pin(0, mode=machine.Pin.IN, pull=None)
|
|
|
|
|
|
|
|
print(pin.value())
|
|
|
|
#+end_src
|