Пример #1
0
    def __init__(self):
        self.current_ssid = 'N/A'
        file = open('/flash/etc/settings.txt', 'r')
        self.settings = json.loads(file.read())
        file.close()

        self.sta = network.WLAN(network.STA_IF)
        self.ap = network.WLAN(network.AP_IF)

        self.connect()

        telnet.start(user=self.settings['user'][0],
                     password=self.settings['user'][1],
                     timeout=5000)
Пример #2
0
def main():
    wlan = WLAN(STA_IF)
    wlan.active(True)
    nets = wlan.scan()
    for net in nets:
        ssid = net[0]
        if ssid == b'Jxxxxxxxxxe':
            wlan.connect(ssid, 'xxxxxxxx')
            while not wlan.isconnected():
                idle()  # save power while waiting
            print('WLAN connection succeeded!')
            ftp.start(user='******', password='******')
            telnet.start(user='******', password='******')
            break
Пример #3
0
    hostname = 'megacontroller' # Would this be our personal ip address
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")

# start telnet server for remote login
from network import telnet

print("start telnet server")

# Change

telnet.start(user='******', password='******')

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    time.sleep(1)
Пример #4
0
print("WiFi connected at", wlan.ifconfig()[0])
# Advertise as 'hostname', alternative to IP address
try:
    hostname = '​Alexis'
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")

# start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******', password='******')

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    time.sleep(1)
Пример #5
0
    print("Waiting for wlan connection")
    time.sleep(1)

print("WiFi connected at", wlan.ifconfig()[0])

try:
    hostname = 'wigglesby'
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")

print("start telnet server")
telnet.start(user='******', password='******')

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 5
for _ in range(5):
    if rtc.synced():
        break
    time.sleep(1)

if rtc.synced():
    print(time.strftime("%c", time.localtime()))
else:
    print("cannot get NTP time")
Пример #6
0
#Advertise as 'hostname', alternative to IP address
try:
    hostname = 'wifinetwork'
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSERROR:
    print("Failed starting mDNS server - already started?")

#start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******', password='******')

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    time.sleep(1)
Пример #7
0
try:
    hostname = 'BOSERBOIS'
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")


#### TO DO: Modify mqtt broker, get this publisher set up as a callback to a timer
#start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******', password='******')
#Set up pulissher node
from mqttclient import MQTTClient 
from time import sleep
from machine import deepsleep
#set up broker
BROKER = 'iot.eclipse.org'
USER = ''
PWD = ''
mqtt = MQTTClient(BROKER)
topic = 
sleep(0.3)

### TO DO: Set up the callback to record and actuate the servos at the same time, 
#also possibly figure out phased arrays
Пример #8
0
# Advertise as 'hostname', alternative to IP address
try:
    hostname = 'veryviruswifi'
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")

# start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******', password='******')

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    sleep(1)
Пример #9
0
        "service": "my_hostname Telnet REPL"
    })
    _ = mdns.addService('_http', '_tcp', 80, "MicroPython", {
        "board": "ESP32",
        "service": "my_hostname Web server"
    })
    print("Advertised locally as {}.local".format(hostname))

except OSError:
    print("Failed starting mDNS server - already started?")

# start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******', password='******')

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    time.sleep(1)
Пример #10
0
# Advertise as 'hostname', alternative to IP address
try:
    hostname = "a&k"
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")

# start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******', password='******')

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    time.sleep(1)
Пример #11
0
# Advertise as 'hostname', alternative to IP address
try:
    hostname = 'JoJo'
    mdns = mDNS(wlan)
    mdns.start(hostname, "MicroPython REPL")
    mdns.addService('_repl', '_tcp', 23, hostname)
    print("Advertised locally as {}.local".format(hostname))
except OSError:
    print("Failed starting mDNS server - already started?")

# start telnet server for remote login
from network import telnet

print("start telnet server")
telnet.start(user='******',
             password='******')  #dependent on microcontroller - use config

# fetch NTP time
from machine import RTC

print("inquire RTC time")
rtc = RTC()
rtc.ntp_sync(server="pool.ntp.org")

timeout = 10
for _ in range(timeout):
    if rtc.synced():
        break
    print("Waiting for rtc time")
    time.sleep(1)