Micropython for ESP8266

View previous topic View next topic Go down

Micropython for ESP8266

Post by KeithE on Sat Mar 04, 2017 8:41 pm

Has anyone written Micropython code (on ESP8266 platform) to interface with RoboRemo? I can't seem to connect to my device. I would ideally like to use the AP mode.

I thought the setup would resemble something like the following. However I'm never able to get past the call to accept. (The AP is up by default, and the IP is 192.168.4.1.)

Code:

import socket
import uos
import network

port = 9876
listen_s = socket.socket() -- I think that the defaults are ok
listen_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) -- not sure about this?

ai = socket.getaddrinfo("0.0.0.0", port)
addr = ai[0][4]

listen_s.bind(addr)
listen_s.listen(1)
for i in (network.AP_IF, network.STA_IF):
iface = network.WLAN(i)
if iface.active():
print("WebREPL daemon started on ws://%s:%d" % (iface.ifconfig()[0], port))

cl, remote_addr = listen_s.accept()

KeithE

Posts : 2
Join date : 2017-03-04

View user profile

Back to top Go down

Re: Micropython for ESP8266

Post by KeithE on Mon Mar 06, 2017 7:01 pm

Actually I think this sort of code does work, but I'm having a problem with one of my phones. I have two Nexus 6 phones, and only one of them is able to connect. The one that works is more up to date than the other as far as Android due to carrier issues, but they both used to work.

KeithE

Posts : 2
Join date : 2017-03-04

View user profile

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum