Skip to content

[MKC-1703] Fixes for the Micropython course #2035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Now take a look at what happens after each statement. Notice the empty space jus
Anything inside of this indentation will execute if the statement is met, and this is a fundamental principle that is used in every Python program that you write!

Now since we already defined `x` to be `5+5`, the terminal will of course print:
- `"x is larger than 10"`
- `"x is exactly 10"`

## While Loop

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ To do this, we can edit our `boot.py` file. Remember, the code on this file is t

![Select the Boot.py file.](assets/bootfile.png)

Then, in the `boot.py` file, we can past the Wi-Fi connection code that we just previously.
Then, in the `boot.py` file, we can use the Wi-Fi connection code that we used previously.

```python
"""
Expand All @@ -104,6 +104,10 @@ It will automatically run when
you start your board, and connects
to the Wi-Fi network specified.
"""
import network

WIFI_NETWORK='YOUR_NETWORK_NAME'
WIFI_PASSWORD='YOUR_NETWORK_PASSWORD'

wlan = network.WLAN(network.STA_IF)
wlan.active(True)
Expand Down Expand Up @@ -177,7 +181,7 @@ Once we run the script, after a while, we should be receiving the response. This

We now have a device that is capable of accessing the weather from anywhere in the world!

## Exercise 2: Internet Clock
## Exercise 3: Internet Clock

In this exercise, we will make a request to something called an network time protocol (NTP) server.

Expand All @@ -193,7 +197,7 @@ TIMESTAMP = 2208988800
# Create new socket
client = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM)
client.bind(("", 8080))
#client.settimeout(3.0)
client.settimeout(3.0)

# Get addr info via DNS
addr = usocket.getaddrinfo("pool.ntp.org", 123)[0][4]
Expand Down