Beispiel #1
0
def main():
    oled = get_oled()
    screen = Screen(oled)
    wait_for_networking()
    conf = get_conf()
    APPID = conf['APPID']
    for i in range(3):
        show_random_weather(screen, APPID)
Beispiel #2
0
def main():
    oled = get_oled()
    screen = Screen(oled)
    wait_for_networking()
    conf = get_conf()
    APPID = conf['APPID']
    for city in CITIES:
        show_weather(screen, APPID, city)
Beispiel #3
0
def main():
    wait_for_networking()
    conf = get_conf()
    APPID = conf['APPID']
    data = get_weather(APPID, 'London')
    print('temp:', data['main']['temp'])
    print('wind:', data['wind']['speed'])
    print('name:', data['name'])
    print('country:', data['sys']['country'])
Beispiel #4
0
def main():
    oled = get_oled()
    screen = Screen(oled)
    wait_for_networking()
    conf = get_conf()
    APPID = conf['APPID']
    button = Pin(BUTTON_A_PIN, Pin.IN, Pin.PULL_UP)
    show_random_weather(screen, APPID)
    while True:
        if not button.value():
            show_random_weather(screen, APPID)
Beispiel #5
0
def main():
    ip = wait_for_networking()
    sock = socket_listen()
    serve_requests(sock, ip)
Beispiel #6
0
def run_server(handler):
    ip = wait_for_networking()
    sock = socket_listen()
    serve_requests(sock, ip, handler)
Beispiel #7
0
def main():
    wait_for_networking()
    url = 'http://micropython.org/ks/test.html'
    html = urequests.get(url).text
    print(html)
Beispiel #8
0
def main():
    wait_for_networking()
    track_space_station()
Beispiel #9
0
def main():
    ip = wait_for_networking()
    print('main started')
    print('device ip:', ip)
Beispiel #10
0
def main():
    wait_for_networking()
    html = fetch('http://micropython.org/ks/test.html')
    print(html)
Beispiel #11
0
"""
Star Wars Asciimation
shows an animation of star wars in ASCII, telnet connection
should also work on computer with Python3.

Source:
URL: http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/network_tcp.html#star-wars-asciimation
"""
import socket
from netcheck import wait_for_networking

USE_DEBUG = False

# check network is connected
wait_for_networking()


# for debugging...
def print_debug(msg):
    if USE_DEBUG:
        print(msg)


# """
# NB. De 'losse' code werkt beter en sneller dan
#     als de functie wordt aangeroepen.
#     Reden: onbekend.
#  2019-1103 Peter

# get addres information of site
url = "towel.blinkenlights.nl"