Browse Source

Update stuff

master
Elis Axelsson 5 years ago
parent
commit
bf9be01ca8
  1. 28
      README.org
  2. 8
      code/main.py

28
README.org

@ -18,29 +18,31 @@ ampy --port /dev/ttyUSB0 put hcsr04.py
* Small card
** Distance measuring
*** HCSR04 Pins
Trig -- D0
Echo -- D3
Vcc -- 5V
GND -- GND
| Pin on component | Pin on card |
|------------------+-------------|
| Trig | D0 |
| Echo | D3 |
| Vcc | 5V |
| GND | GND |
*** Set up distance measuring
#+begin_src python
import tablecode.main
import main
tablecode.main.distance(16, 0)
main.distance()
#+end_src
** Movement sensor
*** Sensor pins
5V -- 5V
GND -- GND
OUT -- D0
| Pin on component | Pin on card |
|------------------+-------------|
| 5V | 5V |
| GND | GND |
| OUT | D1 |
*** Set up movement sensor
#+begin_src python
import machine
import main
pin = machine.Pin(0, mode=machine.Pin.IN, pull=None)
print(pin.value())
main.movement()
#+end_src

8
code/main.py

@ -18,3 +18,11 @@ def distance():
while True:
print(sensor.distance_cm())
time.sleep(1)
def movement():
sensor = machine.Pin(pins.D1, mode=machine.Pin.IN, pull=None)
while True:
print(sensor.value())
time.sleep(1)

Loading…
Cancel
Save