# EV-1 transportband met stappenmotor
import time
from machine import Pin
# outputs
led_14 = Pin(14, Pin.OUT)
led_27 = Pin(27, Pin.OUT)
led_26 = Pin(26, Pin.OUT)
led_25 = Pin(25, Pin.OUT)
#inputs
knop_begin = Pin(15, Pin.IN, Pin.PULL_UP)
knop_start = Pin(16, Pin.IN, Pin.PULL_UP)
knop_pos1 = Pin(17, Pin.IN, Pin.PULL_UP)
knop_pos2 = Pin(18, Pin.IN, Pin.PULL_UP)
print("start test transportband v3")
while True:
# 2048 stapjes CW ( 512 * 4 => 14-27-26-25)
for aantal in range(512):
led_25.value(0)
led_14.value(1)
time.sleep(0.5)
led_14.value(0)
led_27.value(1)
time.sleep(0.5)
led_27.value(0)
led_26.value(1)
time.sleep(0.5)
led_26.value(0)
led_25.value(1)
time.sleep(0.5)
# wacht 2 sec
time.sleep(2)
# 2048 stapjes ACW ( 512 * 4 => 25-26-27-14)
''' Wat vind je in de machine module en de Pin Class?
import machine
dir(machine)
['__class__', '__getattr__', '__name__', 'const', 'ADC', 'ADCBlock', 'DAC',
'DEEPSLEEP', 'DEEPSLEEP_RESET', 'EXT0_WAKE', 'EXT1_WAKE', 'HARD_RESET',
'I2C', 'I2S', 'PIN_WAKE', 'PWM', 'PWRON_RESET', 'Pin', 'RTC', 'SDCard',
'SLEEP', 'SOFT_RESET', 'SPI', 'Signal', 'SoftI2C', 'SoftSPI', '
TIMER_WAKE', 'TOUCHPAD_WAKE', 'Timer', 'TouchPad', 'UART', 'ULP_WAKE',
'WDT', 'WDT_RESET', '__dict__', '__file__', '_machine', 'bitstream',
'deepsleep', 'dht_readinto', 'disable_irq', 'enable_irq', 'freq',
'idle', 'lightsleep', 'mem16', 'mem32', 'mem8', 'reset', 'reset_cause',
'sleep', 'soft_reset', 'time_pulse_us', 'unique_id', 'wake_reason',
'Counter', 'Encoder']
from machine import Pin
help(Pin)
object <class 'Pin'> is of type type
init -- <function>
value -- <function>
off -- <function>
on -- <function>
toggle -- <function>
irq -- <function>
board -- <class 'board'>
IN -- 1
OUT -- 3
OPEN_DRAIN -- 7
PULL_UP -- 2
PULL_DOWN -- 1
IRQ_RISING -- 1
IRQ_FALLING -- 2
WAKE_LOW -- 4
WAKE_HIGH -- 5
DRIVE_0 -- 0
DRIVE_1 -- 1
DRIVE_2 -- 2
DRIVE_3 -- 3
'''