Search found 391 matches

by kevinkk525
Sat Jun 08, 2019 2:27 pm
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 14437

Re: Module for Ultrasonic sensor (HC-SR04)

I guess self._pr isn't defined. you can replace it with 2
self._offs should be 0
by kevinkk525
Wed Jun 05, 2019 4:49 pm
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 14437

Re: Module for Ultrasonic sensor (HC-SR04)

async def _read(self) -> float: """ Returns distance in cm. Optionally compensated by temperature in °C. :return: float """ val = [] warnings = 0 # probably not going to happen that both warning types occur at the same time warning = "minimum distance reached or different problem" for _ in range(20...
by kevinkk525
Wed Jun 05, 2019 4:44 pm
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 14437

Re: Module for Ultrasonic sensor (HC-SR04)

Remove all the log instructions and add an optional parameter temp to the function like in my code. (temp=None)

It only corrects with a temperature if it gets one.
I'm currently not at home and only with my phone so can't give you a stripped down version.
by kevinkk525
Wed Jun 05, 2019 8:04 am
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 14437

Re: Module for Ultrasonic sensor (HC-SR04)

As the comment in the code says it outputs meters.

You can use my library for comparison (you have to remove project specific imports and base class first though): https://github.com/kevinkk525/pysmartno ... /hcsr04.py
by kevinkk525
Tue Jun 04, 2019 7:41 pm
Forum: General Discussion and Questions
Topic: Debugging boot, safe mode ?
Replies: 10
Views: 234

Re: Debugging boot, safe mode ?

Interesting, I have never seen that behavior. Not on my esp8266 nor on my Esp32

Try adding this to your boot.py before executing any of your code:

import utime
utime.sleep_ms(100)
by kevinkk525
Tue Jun 04, 2019 5:53 pm
Forum: Programs, Libraries and Tools
Topic: retrieving data from coro (esp822)
Replies: 3
Views: 118

Re: retrieving data from coro (esp822)

Since you only send what you receive, I ask myself why you don't just do everything in one coro. But to answer your question you can use uasynio events. I'm not answering from my pc so this will be very short: Ev=Event() In reader: Ev.set(read_data) In writer: Await Ev Swriter.write(Ev.data) Ev.rese...
by kevinkk525
Thu May 30, 2019 9:23 am
Forum: ESP32 boards
Topic: Limitations of MicroPython with ESP32
Replies: 3
Views: 245

Re: Limitations of MicroPython with ESP32

My project doesn't get bigger than 4KLOC (as .mpy) either, even when using a lot of sensors. Working fine on an ESP32 without PSRAM.
by kevinkk525
Thu May 30, 2019 6:26 am
Forum: General Discussion and Questions
Topic: New MicroPython release: v1.11
Replies: 3
Views: 276

Re: New MicroPython release: v1.11

Congrats, great job! Looking forward to 2.0 :D

Also fixed is a rare esp8266 bug that could cause uasyncio to block everything for 1h 11 minutes. No more watchdog needed on my esp8266s.
by kevinkk525
Tue May 28, 2019 6:14 pm
Forum: ESP32 boards
Topic: Does ESP32 restart automatically after an exception is thrown like ESP8266?
Replies: 1
Views: 153

Re: Does ESP32 restart automatically after an exception is thrown like ESP8266?

None of these devices restarts when an exception is thrown. You have to implement that yourself:

Code: Select all

import machine

try:
    your_code()
except Exception as e:
    # do something with the exception, or not
    machine.reset()
by kevinkk525
Tue May 28, 2019 1:47 pm
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 35
Views: 946

Re: How to switch on a electric bulb with ESP8266 board?

time.sleep( for 1 hour)
is certainly not right :D