added pin numbers

This commit is contained in:
Peter Lorenz 2021-11-04 14:44:19 +02:00
parent 6eb2282180
commit 3002c7f2c2
2 changed files with 25 additions and 15 deletions

View File

@ -5,22 +5,26 @@ import time
_PWM_MAX = const(65535)
_PWM_FREQ = const(2000)
_PIN_EN_MOTOR_VERT = const(0)
_PIN_A_MOTOR_VERT = const(0)
_PIN_B_MOTOR_VERT = const(0)
_PIN_EN_MOTOR_VERT = const(14)
_PIN_A_MOTOR_VERT = const(13)
_PIN_B_MOTOR_VERT = const(12)
_PIN_EN_MOTOR_HOR = const(0)
_PIN_A_MOTOR_HOR = const(0)
_PIN_B_MOTOR_HOR = const(0)
_PIN_EN_MOTOR_HOR = const(15)
_PIN_A_MOTOR_HOR = const(11)
_PIN_B_MOTOR_HOR = const(10)
_PIN_EN_BACKLIGHT = const(0)
_PIN_EN_FRONTLIGHT = const(0)
_PIN_EN_BACKLIGHT = const(17)
_PIN_A_BACKLIGHT = const(18)
_PIN_B_BACKLIGHT = const(19)
_PIN_EN_FRONTLIGHT = const(16)
_PIN_A_FRONTLIGHT = const(20)
_PIN_B_FRONTLIGHT = const(21)
_PIN_LED_RED_BTN = const(0)
_PIN_LED_BLU_BTN = const(0)
_PIN_LED_RED_BTN = const(2)
_PIN_LED_BLU_BTN = const(4)
_PIN_RED_BTN = const(0)
_PIN_BLU_BTN = const(0)
_PIN_RED_BTN = const(3)
_PIN_BLU_BTN = const(5)
_PIN_SENS_END_VERT = const(0)
_PIN_SENS_CNT_VERT = const(0)

View File

@ -3,12 +3,15 @@ import time
led = Pin(25, Pin.OUT)
btn_blu = Pin(2, Pin.IN, Pin.PULL_UP)
btn_blu = Pin(5, Pin.IN, Pin.PULL_UP)
btn_red = Pin(3, Pin.IN, Pin.PULL_UP)
led_blu = Pin(4, Pin.OUT)
led_red = Pin(2, Pin.OUT)
def user_interaction(timeout):
def _toggle_leds(timer):
led.toggle()
led_blu.toggle()
led_red.toggle()
tmr = Timer()
tmr.init(freq=2, mode=Timer.PERIODIC, callback=_toggle_leds)
startime = time.ticks_ms()
@ -19,6 +22,8 @@ def user_interaction(timeout):
tmr.deinit()
return 'B' if not b else 'R'
tmr.deinit()
led_blu.value(0)
led_red.value(0)
return 'T' # Timeout
def recording(timeout):
@ -36,4 +41,5 @@ def recording(timeout):
return 'OK'
if __name__ == '__main__':
print(recording(20))
print(user_interaction(20))
#print(recording(20))