Browse Source

Add docs and methods to raise up and lower down

master
Elis Axelsson 5 years ago
parent
commit
3ff107ffef
  1. 11
      README.org
  2. 14
      code/main.py

11
README.org

@ -15,7 +15,7 @@ picocom /dev/ttyUSB0 -b115200
ampy --port /dev/ttyUSB0 put hcsr04.py
#+END_SRC
* Small card
* How to connect things
** Distance measuring
*** HCSR04 Pins
| Pin on component | Pin on card |
@ -46,3 +46,12 @@ import main
main.movement()
#+end_src
** Relay
*** Pins
| Pin on component | Pin on card |
|------------------+-------------|
| Vcc | 5V |
| Gnd | GND |
| In1 | D2 |
| In2 | D3 |

14
code/main.py

@ -1,4 +1,4 @@
from pinouts import Wemos as pins
from pinouts import NodeMCU as pins
from hcsr04 import HCSR04
import time
import machine
@ -26,3 +26,15 @@ def movement():
while True:
print(sensor.value())
time.sleep(0.5)
def toggleRaiseUp():
relayUp = machine.Pin(pins.D2, mode=machine.Pin.OUT)
relayUp.value(not relayUp.value())
def toggleLowerDown():
relayDown = machine.Pin(pins.D3, mode=machine.Pin.OUT)
relayDown.value(not relayDown.value())

Loading…
Cancel
Save