first night at MIPS
This commit is contained in:
parent
19a2d8990c
commit
731a7dabe6
3 changed files with 72 additions and 0 deletions
40
esp8266/ConfigParser.py
Normal file
40
esp8266/ConfigParser.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
class RawConfigParser:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def sections(self):
|
||||
"""Return a list of section names, excluding [DEFAULT]"""
|
||||
pass
|
||||
|
||||
def add_section(self, section):
|
||||
pass
|
||||
|
||||
def has_section(self, section):
|
||||
pass
|
||||
|
||||
def options(self, section):
|
||||
pass
|
||||
|
||||
def read(self, filename = None, fp = None):
|
||||
pass
|
||||
|
||||
def get(self, section, option):
|
||||
|
||||
def items(self, section):
|
||||
|
||||
def getboolean(self, section, option):
|
||||
|
||||
def has_option(self, section, option):
|
||||
"""Check for the existence of a given option in a given section."""
|
||||
|
||||
def set(self, section, option, value=None):
|
||||
"""Set an option."""
|
||||
|
||||
def write(self, fp):
|
||||
"""Write an .ini-format representation of the configuration state."""
|
||||
|
||||
def remove_option(self, section, option):
|
||||
"""Remove an option."""
|
||||
|
||||
def remove_section(self, section):
|
||||
"""Remove a file section."""
|
|
@ -0,0 +1,19 @@
|
|||
def do_connect():
|
||||
import network
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
if not wlan.isconnected():
|
||||
print('connecting to network...')
|
||||
wlan.connect("MIPS", "importthis")
|
||||
while not wlan.isconnected():
|
||||
pass
|
||||
print('network config:', wlan.ifconfig())
|
||||
|
||||
do_connect()
|
||||
|
||||
import gc
|
||||
import webrepl
|
||||
webrepl.start()
|
||||
gc.collect()
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
from machine import Pin
|
||||
from urequests import get
|
||||
from time import sleep_ms
|
||||
from gc import collect
|
||||
|
||||
pin = Pin(2, Pin.IN)
|
||||
pin_value = pin.value()
|
||||
while True:
|
||||
current_value = pin.value()
|
||||
if pin_value != current_value:
|
||||
get('http://192.168.44.174:6543/value/%s' % current_value)
|
||||
pin_value = current_value
|
||||
collect()
|
Loading…
Reference in a new issue