Search found 5956 matches

by pythoncoder
Fri Jun 24, 2022 9:47 am
Forum: Announcements and News
Topic: RFC: Move forums to GitHub Discussions
Replies: 6
Views: 24964

Re: RFC: Move forums to GitHub Discussions

...Having to smack four spaces in front of code in order for it to present as code in Markdown is just as annoying as using code tags... You don't have to do that in GitHub flavoured markdown. The following will work: ```python def foo(): print('foo') ``` A valid question is whether new users will ...
by pythoncoder
Sun Jun 19, 2022 11:56 am
Forum: General Discussion and Questions
Topic: Clearing a bytearray like a list?
Replies: 9
Views: 2567

Re: Clearing a bytearray like a list?

Writing non-allocating applications is quite difficult. You need to acquire a lot of knowledge about when MP allocates. The way I've done this is to run code fragments in an ISR on a platform that supports hard IRQ's. But in general there is no need to worry unduly about allocation - just let the GC...
by pythoncoder
Sat Jun 18, 2022 8:52 am
Forum: ESP8266 boards
Topic: microWebSrv on ESP8266, and general question
Replies: 4
Views: 2033

Re: microWebSrv on ESP8266, and general question

See this doc for information on freezing bytecode. Using this technique it is possible to install libraries comprising hundreds of lines of code and to run applications with plenty of free RAM.
by pythoncoder
Sat Jun 18, 2022 8:46 am
Forum: ESP8266 boards
Topic: Racing RTC - days pass in a minute
Replies: 6
Views: 3535

RTC precision

The issue isn't the RTC logic on the chip, it's the type of oscillator that drives it. ESP8266 board use an RC oscillator which has poor accuracy owing to component tolerances. Good quality boards use a 32KHz crystal which will give excellent accuracy. STM goes further by enabling the crystal oscill...
by pythoncoder
Sat Jun 18, 2022 8:32 am
Forum: General Discussion and Questions
Topic: Clearing a bytearray like a list?
Replies: 9
Views: 2567

Re: Clearing a bytearray like a list?

Two points. It's worth issuing gc.collect() before taking any measurement of free or allocated RAM. Secondly, your use of threading looks hazardous. I would do the writing as a coroutine. If you must use threads you need a lock to ensure that you don't write out data which is half way through being ...
by pythoncoder
Fri Jun 17, 2022 5:52 pm
Forum: ESP32 boards
Topic: uasyncio streamreader hanging on uart.readline
Replies: 3
Views: 1430

Re: uasyncio streamreader hanging on uart.readline

Hmm. I'm getting no joy at all. According to the docs for my Feather S2 the rx and tx pins are connected to UART 0. However a simple loopback test doesn't work. .any() returns some stupid number. .write(b'hello\n') returns nothing (should return 6). And .read() produces nothing. I tried UART 1: .wri...
by pythoncoder
Fri Jun 17, 2022 8:33 am
Forum: General Discussion and Questions
Topic: Newby Q. Making a macro keyboard.
Replies: 2
Views: 849

Re: Newby Q. Making a macro keyboard.

The data sent from a keyboard to a PC is a scan code, not a Unicode string. I'm no expert on this - I suggest you Google "keyboard scan code". The conversion to Unicode occurs in the PC. It may be that your PC needs a special driver to convert scan codes to your language.
by pythoncoder
Fri Jun 17, 2022 8:24 am
Forum: ESP32 boards
Topic: ESP32-S2 MQTT subscriber "OSError: [Errno 113] ECONNABORTED"
Replies: 17
Views: 15372

Re: ESP32-S2 MQTT subscriber "OSError: [Errno 113] ECONNABORTED"

I suspect there is something wrong with your setup as I have had a test running for two days with an ESP32-S2 running mqtt_as.

Have you checked network connectivity? Can you ping the ESP from a PC? Have you ensured that there is a good quality power source i.e. a short USB lead with low resistance?
by pythoncoder
Fri Jun 17, 2022 7:50 am
Forum: Raspberry Pi microcontroller boards
Topic: RP2 multithreading - Pin - UART - should I switch to C? -> changed to PRINT stops
Replies: 7
Views: 2384

Re: RP2 multithreading - Pin - UART - should I switch to C? -> changed to PRINT stops

Try this: import _thread from time import sleep_ms running = True count = 0 def other(): global count while running: count += 1 sleep_ms(100) def main(): global running print("Running...") _thread.start_new_thread(other, ()) # Tuple of args while count < 100: print(count) sleep_ms(1000) running = Fa...