Python and the Internet of Things Hack Chat Weds. April 3rd noon PDT / 3pm EDT @Hackadayio @hackaday @adafruit @circuitpython #IoT #Python

32619Hackchat

Python and the Internet of Things Hack Chat | Hackaday.io. The power of Python on microcontrollers – Wednesday, April 3, 2019 12:00pm PDT / 3pm EDT a Hack Chat at hackaday.io!

The CircuitPython team from Adafruit (Dan Halbert, Kattni Rembor, Scott Shawcroft, Limor “Ladyada” Fried, and Phillip Torrone) will be hosting the Hack Chat on Wednesday, April 3, 2019 at noon PDT / 3pm EDT.

Time zones got you down? Here’s a handy time converter!

Opinions differ about what the most-used programming language in right now is, but it’s hard to deny both the popularity and versatility of Python. In the nearly 30 years since it was invented it has grown from niche language to full-blown development environment that seems to be everywhere these days. That includes our beloved microcontrollers now with CircuitPython, greatly lowering the bar for entry-level hackers and simplifying and speeding development for old hands and providing a path to a Python-powered Internet of Things.

The CircuitPython team from Adafruit Industries will drop by the Hack Chat to answer all your questions about Python and the IoT. Join us as we discuss:

  • How CircuitPython came to be;
  • The range of IoT products that support Python;
  • Getting started with Python on IoT devices; and
  • What’s on the horizon for a Python-powered IoT?

And as extra enticement, we’ll be giving away five free one-year passes to Adafruit.io! We’ll draw five names at random from the list of Hack Chat attendees. Stop by for a chance to win.

JOIN US!

We’ll also be broadcasting behind the scenes live via Hangouts – YouTube.

4319Hackchat

And here’s a Hack Chat countdown, made with Python and IoT goodness to check out!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"""
This example will figure out the current local time using the internet, and
then draw out a countdown clock until an event occurs!
Once the event is happening, a new graphic is shown
"""
import time
import board
from adafruit_pyportal import PyPortal
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
 
# The time of the thing!
EVENT_YEAR = 2019
EVENT_MONTH = 4
EVENT_DAY = 3
EVENT_HOUR = 15
EVENT_MINUTE = 0
# we'll make a python-friendly structure
event_time = time.struct_time((EVENT_YEAR, EVENT_MONTH, EVENT_DAY,
                               EVENT_HOUR, EVENT_MINUTE, 0,  # we don't track seconds
                               -1, -1, False))  # we dont know day of week/year or DST
 
# determine the current working directory
# needed so we know where to find files
cwd = ("/"+__file__).rsplit('/', 1)[0]
# Initialize the pyportal object and let us know what data to fetch and where
# to display it
pyportal = PyPortal(status_neopixel=board.NEOPIXEL,
                    default_bg=cwd+"/countdown_background.bmp")
 
big_font = bitmap_font.load_font(cwd+"/fonts/Helvetica-Bold-36.bdf")
big_font.load_glyphs(b'0123456789') # pre-load glyphs for fast printing
event_background = cwd+"/countdown_event.bmp"
 
days_position = (8, 207)
hours_position = (110, 207)
minutes_position = (220, 207)
text_color = 0xFFFFFF
 
text_areas = []
for pos in (days_position, hours_position, minutes_position):
    textarea = Label(big_font, text='  ')
    textarea.x = pos[0]
    textarea.y = pos[1]
    textarea.color = text_color
    pyportal.splash.append(textarea)
    text_areas.append(textarea)
refresh_time = None
 
while True:
    # only query the online time once per hour (and on first run)
    if (not refresh_time) or (time.monotonic() - refresh_time) > 3600:
        try:
            print("Getting time from internet!")
            pyportal.get_local_time()
            refresh_time = time.monotonic()
        except RuntimeError as e:
            print("Some error occured, retrying! -", e)
            continue
 
    now = time.localtime()
    print("Current time:", now)
    remaining = time.mktime(event_time) - time.mktime(now)
    print("Time remaining (s):", remaining)
    if remaining < 0:
        # oh, its event time!
        pyportal.set_background(event_background)
        while True:  # that's all folks
            pass
    secs_remaining = remaining % 60
    remaining //= 60
    mins_remaining = remaining % 60
    remaining //= 60
    hours_remaining = remaining % 24
    remaining //= 24
    days_remaining = remaining
    print("%d days, %d hours, %d minutes and %s seconds" %
          (days_remaining, hours_remaining, mins_remaining, secs_remaining))
    text_areas[0].text = '{:>2}'.format(days_remaining)  # set days textarea
    text_areas[1].text = '{:>2}'.format(hours_remaining) # set hours textarea
    text_areas[2].text = '{:>2}'.format(mins_remaining)  # set minutes textarea
 
    # update every 10 seconds
    time.sleep(10)

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — The 2024 Recap Issue!

Maker Business – Adafruit Daily — Apple to build another chip at TSMC Arizona

Electronics – Adafruit Daily — SMT Tip – Stop moving around!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


No Comments

No comments yet.

Sorry, the comment form is closed at this time.