Search found 2485 matches

by pythoncoder
Mon Apr 23, 2018 9:46 am
Forum: The MicroPython pyboard
Topic: Interrupt and ADC
Replies: 2
Views: 42

Re: Interrupt and ADC

It looks OK, but it won't terminate because there's no exit from the while True loop.

You might want to look at the ADC.read_timed_multi in the latest firmware which provides a means of reading multiple ADC's in response to a timer tick. This might offer smaller code.
by pythoncoder
Mon Apr 23, 2018 8:41 am
Forum: General Discussion and Questions
Topic: Problems with running umqtt client asynchronously in main.py
Replies: 4
Views: 58

Re: Problems with running umqtt client asynchronously in main.py

In general there are no restrictions on using main.py to launch a MicroPython program. However there are many situations in which the official MQTT client can block and possibly you're encountering one of these. An asynchronous MQTT client involves a significant rewrite involving the use of nonblock...
by pythoncoder
Sun Apr 22, 2018 9:18 am
Forum: ESP8266 boards
Topic: ~ operator binary complement
Replies: 1
Views: 33

Re: ~ operator binary complement

It is implemented:

Code: Select all

>>> a = b'\x01'
>>> ~a[0]
-2
>>> 
The 1's complement of 1 is 11111110 which, viewed as a signed number in 2's complement notation, is -2.
by pythoncoder
Sun Apr 22, 2018 9:12 am
Forum: Programs, Libraries and Tools
Topic: uasyncio: number of tasks in the event loop
Replies: 3
Views: 111

Re: uasyncio: number of tasks in the event loop

A good tool for error checking and PEP8 compliance is pylint.
by pythoncoder
Sun Apr 22, 2018 8:58 am
Forum: ESP32 boards
Topic: micropyGPS crashes my ESP32
Replies: 18
Views: 239

Re: micropyGPS crashes my ESP32

cable134 wrote:
Sat Apr 21, 2018 9:41 pm
As for me, strange, that I do not have any garbage data if I do not call

Code: Select all

stat = my_gps.update(chr(x))
I would try a test without using the _thread module in case there is an issue with that and the UART.
by pythoncoder
Sun Apr 22, 2018 8:51 am
Forum: ESP8266 boards
Topic: Different behavior of sensor between boards
Replies: 4
Views: 113

Re: Different behavior of sensor between boards

jimako wrote:
Sun Apr 22, 2018 7:43 am
Indeed, after switching the sensor to an external power supply, the fluctuations are gone, and the measurements are back to normal...
Unfortunately I don't have an oscilloscope right now to confirm this.
I think you've proved the point, even without a 'scope.
by pythoncoder
Sat Apr 21, 2018 9:28 am
Forum: ESP8266 boards
Topic: Different behavior of sensor between boards
Replies: 4
Views: 113

Re: Different behavior of sensor between boards

If you have access to an oscilloscope you could check for noise on the DHT11 power line. Otherwise experiment with decoupling capacitors.
by pythoncoder
Sat Apr 21, 2018 8:39 am
Forum: General Discussion and Questions
Topic: Synchronizing Modules Recursively from Desktop to Board
Replies: 5
Views: 93

Re: Synchronizing Modules Recursively from Desktop to Board

You can avoid the string join (and the ingenious use of map/format) by using ubinascii.hexlify:

Code: Select all

>>> ubinascii.hexlify(calculateSha1('rats.py'))
b'53e9dbba64ac30746f8c1e6cb477fe7a5fcb02d5'
>>>
by pythoncoder
Sat Apr 21, 2018 7:51 am
Forum: ESP32 boards
Topic: greenhouse sensors set-up
Replies: 6
Views: 181

MQTT resilience

I think it's fair to say that writing a resilient MQTT driver is non-trivial. By "resilient" I mean able to run for long periods while recovering from the following events: Sudden WiFi dropouts Broker outages Slow connections (if the broker is on the internet). Gradual complete loss and subsequent r...
by pythoncoder
Sat Apr 21, 2018 7:33 am
Forum: General Discussion and Questions
Topic: Python properties ...
Replies: 5
Views: 151

Re: Python properties ...

...I will dig into asyncio, I never used it on Python and will investigate there before switching to micropython... For learning most Python modules that is the approach I would recommend. Alas Python's asyncio library has changed substantially over the years. Despite experience with cooperative mu...