Esempio n. 1
0
from machine import Pin
import network

import esp
esp.osdebug(None)

import gc
gc.collect()

wcss = """<style>html{font-family: Helvetica; display:inline-block; margin: 0px auto; text-align: center;}
  h1{color: Silver; padding: 2vh;}p{font-size: 1.5rem;}.button{display: inline-block; background-color: Orange; border: none; 
  border-radius: 4px; color: white; padding: 16px 40px; text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}
  .button2{background-color: Navy;}</style>"""

wbott = "<br /><hr />2019 - workskop test<br />" + get_eui()

def web_page():
  web_info = "web-info"
  web_temp = str(get_temp(*t))

  html = """<html><head> <title>octopusLAB - ESP Web Server</title> <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" href="data:,"> """ + wcss + """
  <script language="JavaScript">
  function print_todays_date(){var d = new Date();document.write(d.toLocaleString());}
  setTimeout(function() {location.reload();},3500);
  </script>
  </head><body> <h1>octopus LAB - ESP Web Server</h1>
  <p>Temperature: <strong></strong></p><p><a href="/?led=on"><button class="button">""" + web_temp + """</button></a></p>
  <p><br />
  <script language="JavaScript">print_todays_date();</script>""" + wbott + """</p></body></html>"""
Esempio n. 2
0
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(('', 80))
    s.listen(5)
    printFree()

    return s


wcss = """<style>html{font-family: Helvetica; display:inline-block; margin: 0px auto; text-align: center;}
  h1{color: Silver; padding: 2vh;}p{font-size: 1.5rem;}.button{display: inline-block; background-color: Orange; border: none; 
  border-radius: 4px; color: white; padding: 16px 40px; text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}
  .button2{background-color: Navy;}</style>"""

web_info = ""
web_bott = "<br /><hr />octopusLAB - wifi setup - uID: <br />" + get_eui()
web_form = """
  <form>
  ssid: <br><input id="fssid" type="text" name="ssid"><br>
  password: <br><input type="text" name="pass"><br><br>
  <input type="submit" value="Submit">
  </form>"""


def web_page():
    html = """<html><head> <title>octopus ESP setup</title> <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" href="data:,"> """ + wcss + """
  <script>function autoFill(ssid){document.getElementById('fssid').value = ssid;}</script>
  </head><body> <h1>octopusLAB - ESP WiFi setup</h1>
  """ + web_info + web_form + """
  <p>""" + web_wifi + """</p>