Search found 11 matches

by deonis
Wed Dec 26, 2018 3:44 am
Forum: General Discussion and Questions
Topic: Switching relay via uart works from REPL but not from main.py
Replies: 9
Views: 4685

Re: Switching relay via uart works from REPL but not from main.py

Hi, Gregor, you might be interested in the project below. You can easily modify it for your needs. This is esp-12 based timed delay relay. It uses a socket server to serve webpage but you can send an array of values to the socket server if you do not want GUI control. https://github.com/deonis1/wifi...
by deonis
Fri Nov 30, 2018 7:03 pm
Forum: ESP8266 boards
Topic: [SOLVED] Crashing/freezing every few hours
Replies: 29
Views: 29520

Re: Crashing/freezing every few hours

One thing I noticed for nodeMCU or esp12 boards if you leave both station and access point enabled you will get those freezes every day. I usually use 1.91 version of micropython for these boards, disable access point, and connect the ESPs to the router. Also, some routers do not like active socket ...
by deonis
Sat Nov 03, 2018 4:12 pm
Forum: ESP8266 boards
Topic: Strange behavior of time on ESP8266
Replies: 24
Views: 12334

Re: Strange behavior of time on ESP8266

Your design looks good but I had some problem with NodeMCU-like boards. They are very peaky on the power supply because of AMS1117 voltage regulator. I also use a mobile phone power supply for all my application with esp8266. Some tips: If you have access point enabled on your esp8266 disable it. It...
by deonis
Fri Nov 02, 2018 9:34 pm
Forum: ESP8266 boards
Topic: Strange behavior of time on ESP8266
Replies: 24
Views: 12334

Re: Strange behavior of time on ESP8266

Your problem might not be with software but with hardware. Which version of Micropython do you use? Are you running esp8266 in the dual mode or station mode only? Do you know the uptime of your board? Does it correlate with the real time? Also what voltage regulator LoLin board uses? Does it dip bel...
by deonis
Sun Sep 16, 2018 4:00 am
Forum: General Discussion and Questions
Topic: How to check if a python module exists without importing it
Replies: 6
Views: 5110

Re: How to check if a python module exists without importing it

You can use

Code: Select all

help("modules")
or if you want more details for a specific module then you need to import and use simialr command to get details.
For example:

Code: Select all

import sys
help(sys) 
by deonis
Thu Sep 06, 2018 1:37 am
Forum: ESP8266 boards
Topic: How to check gpio pin input, when http-server is running?
Replies: 8
Views: 5558

Re: How to check gpio pin input, when http-server is running?

I assume you mean machine.Timer ? It might be worth trying.

from machine import Timer

tim = Timer(-1)
tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
by deonis
Wed Sep 05, 2018 4:50 am
Forum: ESP8266 boards
Topic: How to check gpio pin input, when http-server is running?
Replies: 8
Views: 5558

Re: How to check gpio pin input, when http-server is running?

Asynchronous socket server : import uasyncio as asyncio async def dummyloop(): while True: print("Hello World") await asyncio.sleep(0.01) # await asyncio.sleep(1) print("Bye Bye") @asyncio.coroutine def serve(reader, writer): try: with open("index.html", "r") as fhtml: html = fhtml.readlines() excep...
by deonis
Fri Aug 31, 2018 9:24 pm
Forum: ESP8266 boards
Topic: How to check gpio pin input, when http-server is running?
Replies: 8
Views: 5558

Re: How to check gpio pin input, when http-server is running?

I see. The only way, to my knowledge, to read the value in the loop while running the socket server is to use _thread or uasyncio library. Please take a look at this example by Peter: https://github.com/peterhinch/micropython-async/blob/master/aqtest.py An alternative way would be to use ajax reques...
by deonis
Fri Aug 31, 2018 3:18 pm
Forum: ESP8266 boards
Topic: How to check gpio pin input, when http-server is running?
Replies: 8
Views: 5558

Re: How to check gpio pin input, when http-server is running?

You will need to wrap your request and socket server with uasyncio library or use _thread library. This way two processes will run independently of one another. For esp8266 use uasyncio: https://github.com/micropython/micropython-lib/tree/master/uasyncio Use help("Modules") to see if you have it on ...
by deonis
Wed Aug 22, 2018 6:32 pm
Forum: ESP32 boards
Topic: Neopixel issue
Replies: 3
Views: 2492

Re: Neopixel issue

How many LEDs do you have?

try this code out https://github.com/deonis1/nphttpd