Skip to content

Commit aaef005

Browse files
authored
Merge pull request #67 from FoamyGuy/docs_fixes
adding example directory and script
2 parents ffcb6df + cfefa18 commit aaef005

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""
5+
NOTE: This PortalBase library is intended to be subclassed by other libraries rather than
6+
used directly by end users. This example shows one such usage with the PyPortal library.
7+
See MatrixPortal, MagTag, and PyPortal libraries for more examples.
8+
"""
9+
# NOTE: Make sure you've created your secrets.py file before running this example
10+
# https://learn.adafruit.com/adafruit-pyportal/internet-connect#whats-a-secrets-file-17-2
11+
12+
13+
import board
14+
from adafruit_pyportal import PyPortal
15+
16+
# Set a data source URL
17+
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
18+
19+
# Create the PyPortal object
20+
pyportal = PyPortal(url=TEXT_URL, status_neopixel=board.NEOPIXEL)
21+
22+
# Set display to show REPL
23+
board.DISPLAY.show(None)
24+
25+
# Go get that data
26+
print("Fetching text from", TEXT_URL)
27+
data = pyportal.fetch()
28+
29+
# Print out what we got
30+
print("-" * 40)
31+
print(data)
32+
print("-" * 40)

0 commit comments

Comments
 (0)