summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hwapi/README.md6
-rw-r--r--examples/hwapi/button_led.py4
-rw-r--r--examples/hwapi/button_reaction.py4
-rw-r--r--examples/hwapi/soft_pwm.py6
-rw-r--r--examples/network/http_client.py5
-rw-r--r--examples/network/http_client_ssl.py14
-rw-r--r--examples/network/http_server.py5
-rw-r--r--examples/network/http_server_simplistic.py5
-rw-r--r--examples/network/http_server_simplistic_commented.py5
-rw-r--r--examples/network/http_server_ssl.py10
-rw-r--r--examples/unix/machine_bios.py2
11 files changed, 22 insertions, 44 deletions
diff --git a/examples/hwapi/README.md b/examples/hwapi/README.md
index f3de752f9..a1b0c5642 100644
--- a/examples/hwapi/README.md
+++ b/examples/hwapi/README.md
@@ -40,13 +40,13 @@ application of this idea would look like:
`app.py`:
from hwconfig import *
- import utime
+ import time
while True:
LED.value(1)
- utime.sleep_ms(500)
+ time.sleep_ms(500)
LED.value(0)
- utime.sleep_ms(500)
+ time.sleep_ms(500)
To deploy this application to a particular board, a user will need:
diff --git a/examples/hwapi/button_led.py b/examples/hwapi/button_led.py
index bd6fe0172..c73bcfc89 100644
--- a/examples/hwapi/button_led.py
+++ b/examples/hwapi/button_led.py
@@ -1,4 +1,4 @@
-import utime
+import time
from hwconfig import LED, BUTTON
# Light LED when (and while) a BUTTON is pressed
@@ -6,4 +6,4 @@ from hwconfig import LED, BUTTON
while 1:
LED.value(BUTTON.value())
# Don't burn CPU
- utime.sleep_ms(10)
+ time.sleep_ms(10)
diff --git a/examples/hwapi/button_reaction.py b/examples/hwapi/button_reaction.py
index e5a139a57..52bdf7938 100644
--- a/examples/hwapi/button_reaction.py
+++ b/examples/hwapi/button_reaction.py
@@ -1,4 +1,4 @@
-import utime
+import time
import machine
from hwconfig import LED, BUTTON
@@ -18,4 +18,4 @@ while 1:
print("Well, you're *really* slow")
else:
print("You are as slow as %d microseconds!" % delay)
- utime.sleep_ms(10)
+ time.sleep_ms(10)
diff --git a/examples/hwapi/soft_pwm.py b/examples/hwapi/soft_pwm.py
index 72291b0ec..466de08f0 100644
--- a/examples/hwapi/soft_pwm.py
+++ b/examples/hwapi/soft_pwm.py
@@ -1,4 +1,4 @@
-import utime
+import time
from hwconfig import LED
@@ -15,10 +15,10 @@ def pwm_cycle(led, duty, cycles):
for i in range(cycles):
if duty:
led.on()
- utime.sleep_ms(duty)
+ time.sleep_ms(duty)
if duty_off:
led.off()
- utime.sleep_ms(duty_off)
+ time.sleep_ms(duty_off)
# At the duty setting of 1, an LED is still pretty bright, then
diff --git a/examples/network/http_client.py b/examples/network/http_client.py
index 0791c8066..661c286b7 100644
--- a/examples/network/http_client.py
+++ b/examples/network/http_client.py
@@ -1,7 +1,4 @@
-try:
- import usocket as socket
-except:
- import socket
+import socket
def main(use_stream=False):
diff --git a/examples/network/http_client_ssl.py b/examples/network/http_client_ssl.py
index 83f685fdf..323971c0e 100644
--- a/examples/network/http_client_ssl.py
+++ b/examples/network/http_client_ssl.py
@@ -1,17 +1,11 @@
-try:
- import usocket as _socket
-except:
- import _socket
-try:
- import ussl as ssl
-except:
- import ssl
+import socket
+import ssl
def main(use_stream=True):
- s = _socket.socket()
+ s = socket.socket()
- ai = _socket.getaddrinfo("google.com", 443)
+ ai = socket.getaddrinfo("google.com", 443)
print("Address infos:", ai)
addr = ai[0][-1]
diff --git a/examples/network/http_server.py b/examples/network/http_server.py
index 76be3ab81..a6ed53154 100644
--- a/examples/network/http_server.py
+++ b/examples/network/http_server.py
@@ -1,7 +1,4 @@
-try:
- import usocket as socket
-except:
- import socket
+import socket
CONTENT = b"""\
diff --git a/examples/network/http_server_simplistic.py b/examples/network/http_server_simplistic.py
index a9831127f..09936b9d9 100644
--- a/examples/network/http_server_simplistic.py
+++ b/examples/network/http_server_simplistic.py
@@ -1,9 +1,6 @@
# Do not use this code in real projects! Read
# http_server_simplistic_commented.py for details.
-try:
- import usocket as socket
-except:
- import socket
+import socket
CONTENT = b"""\
diff --git a/examples/network/http_server_simplistic_commented.py b/examples/network/http_server_simplistic_commented.py
index da042c6c8..d4710ad61 100644
--- a/examples/network/http_server_simplistic_commented.py
+++ b/examples/network/http_server_simplistic_commented.py
@@ -8,10 +8,7 @@
# details, and use this code only for quick hacks, preferring
# http_server.py for "real thing".
#
-try:
- import usocket as socket
-except:
- import socket
+import socket
CONTENT = b"""\
diff --git a/examples/network/http_server_ssl.py b/examples/network/http_server_ssl.py
index 1116c71e9..7766fa7ea 100644
--- a/examples/network/http_server_ssl.py
+++ b/examples/network/http_server_ssl.py
@@ -1,10 +1,6 @@
-import ubinascii as binascii
-
-try:
- import usocket as socket
-except:
- import socket
-import ussl as ssl
+import binascii
+import socket
+import ssl
# This self-signed key/cert pair is randomly generated and to be used for
diff --git a/examples/unix/machine_bios.py b/examples/unix/machine_bios.py
index 878f3fd8f..40aae4cce 100644
--- a/examples/unix/machine_bios.py
+++ b/examples/unix/machine_bios.py
@@ -4,6 +4,6 @@
# It is expected to print 0xaa55, which is a signature at the start of
# Video BIOS.
-import umachine as machine
+import machine
print(hex(machine.mem16[0xC0000]))