Update pins so I can connect everything at once

master
Elis Axelsson 5 years ago
parent cd2b2d7835
commit a3bde0ce81
  1. 10
      README.org
  2. 10
      code/main.py

@ -20,8 +20,8 @@ ampy --port /dev/ttyUSB0 put hcsr04.py
*** HCSR04 Pins
| Pin on component | Pin on card |
|------------------+-------------|
| Trig | D3 |
| Echo | D4 |
| Trig | D2 |
| Echo | D3 |
| Vcc | 5V |
| GND | GND |
@ -38,7 +38,7 @@ main.distance()
|------------------+-------------|
| 5V | 5V |
| GND | GND |
| OUT | D2 |
| OUT | D4 |
*** Set up movement sensor
#+begin_src python
@ -53,5 +53,5 @@ main.movement()
|------------------+-------------|
| Vcc | 5V |
| Gnd | GND |
| In1 | D2 |
| In2 | D3 |
| In1 | D5 |
| In2 | D6 |

@ -13,7 +13,7 @@ def blink():
def distance():
sensor = HCSR04(trigger_pin=pins.D3, echo_pin=pins.D4)
sensor = HCSR04(trigger_pin=pins.D2, echo_pin=pins.D3)
while True:
print(sensor.distance_cm())
@ -29,20 +29,20 @@ def movement():
def resetRelay():
relayUp = machine.Pin(pins.D2, mode=machine.Pin.OUT)
relayDown = machine.Pin(pins.D3, mode=machine.Pin.OUT)
relayUp = machine.Pin(pins.D5, mode=machine.Pin.OUT)
relayDown = machine.Pin(pins.D6, mode=machine.Pin.OUT)
relayUp.value(1)
relayDown.value(1)
def toggleRaiseUp():
relayUp = machine.Pin(pins.D2, mode=machine.Pin.OUT)
relayUp = machine.Pin(pins.D5, mode=machine.Pin.OUT)
relayUp.value(not relayUp.value())
def toggleLowerDown():
relayDown = machine.Pin(pins.D3, mode=machine.Pin.OUT)
relayDown = machine.Pin(pins.D6, mode=machine.Pin.OUT)
relayDown.value(not relayDown.value())

Loading…
Cancel
Save