summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hwapi/button_reaction.py8
-rw-r--r--examples/hwapi/hwconfig_dragonboard410c.py4
-rw-r--r--examples/hwapi/hwconfig_esp8266_esp12.py6
-rw-r--r--examples/hwapi/hwconfig_z_frdm_k64f.py2
4 files changed, 10 insertions, 10 deletions
diff --git a/examples/hwapi/button_reaction.py b/examples/hwapi/button_reaction.py
index 5e1890d5a..b72e813e4 100644
--- a/examples/hwapi/button_reaction.py
+++ b/examples/hwapi/button_reaction.py
@@ -11,9 +11,9 @@ Ready? Cliiiiick!
""")
while 1:
- try:
- delay = machine.time_pulse_us(BUTTON, 1, 10*1000*1000)
- print("You are as slow as %d microseconds!" % delay)
- except OSError:
+ delay = machine.time_pulse_us(BUTTON, 1, 10*1000*1000)
+ if delay < 0:
print("Well, you're *really* slow")
+ else:
+ print("You are as slow as %d microseconds!" % delay)
utime.sleep_ms(10)
diff --git a/examples/hwapi/hwconfig_dragonboard410c.py b/examples/hwapi/hwconfig_dragonboard410c.py
index 8061d7b74..2db21165d 100644
--- a/examples/hwapi/hwconfig_dragonboard410c.py
+++ b/examples/hwapi/hwconfig_dragonboard410c.py
@@ -13,10 +13,10 @@ from machine import Pin
# echo -n "gpio_keys" >/sys/class/input/input1/device/driver/unbind
# User LED 1 on gpio21
-LED = Pin(21, Pin.OUT)
+LED = Signal(Pin(21, Pin.OUT))
# User LED 2 on gpio120
-LED2 = Pin(120, Pin.OUT)
+LED2 = Signal(Pin(120, Pin.OUT))
# Button S3 on gpio107
BUTTON = Pin(107, Pin.IN)
diff --git a/examples/hwapi/hwconfig_esp8266_esp12.py b/examples/hwapi/hwconfig_esp8266_esp12.py
index e8cf2d12e..fb6d5fe90 100644
--- a/examples/hwapi/hwconfig_esp8266_esp12.py
+++ b/examples/hwapi/hwconfig_esp8266_esp12.py
@@ -1,5 +1,5 @@
-from machine import Pin
+from machine import Pin, Signal
# ESP12 module as used by many boards
-# Blue LED on pin 2
-LED = Pin(2, Pin.OUT)
+# Blue LED on pin 2, active low (inverted)
+LED = Signal(Pin(2, Pin.OUT), inverted=True)
diff --git a/examples/hwapi/hwconfig_z_frdm_k64f.py b/examples/hwapi/hwconfig_z_frdm_k64f.py
index c45e3e756..583e8d7aa 100644
--- a/examples/hwapi/hwconfig_z_frdm_k64f.py
+++ b/examples/hwapi/hwconfig_z_frdm_k64f.py
@@ -2,4 +2,4 @@ from machine import Pin
# Freescale/NXP FRDM-K64F board
# Blue LED on port B, pin 21
-LED = Pin(("GPIO_1", 21), Pin.OUT)
+LED = Signal(Pin(("GPIO_1", 21), Pin.OUT))