Search found 181 matches

by HermannSW
Tue May 25, 2021 6:20 pm
Forum: General Discussion and Questions
Topic: Is there a way to encrypt MicroPython codes?
Replies: 11
Views: 1271

Re: Is there a way to encrypt MicroPython codes?

There is a way to make .uf2 run on exactly one (Raspberry Pico) by encrypting the image with Pico's unique flash ID ...
https://www.raspberrypi.org/forums/view ... 3#p1862153
The .uf2 image can contain MicroPython code builtin as others have described.
by HermannSW
Wed May 12, 2021 8:23 am
Forum: Raspberry Pi microcontroller boards
Topic: builtin µs timing code made platform independent (Python[23] / Pico MicroPython)
Replies: 0
Views: 1367

builtin µs timing code made platform independent (Python[23] / Pico MicroPython)

See here for details: https://www.raspberrypi.org/forums/viewtopic.php?f=146&t=311669&p=1863938#p1863938 Summary at end: This is first time that I eliminated platform dependency for using builtin functions from different platforms without performance loss, hopefully this technique will be useful for...
by HermannSW
Mon May 03, 2021 11:01 am
Forum: Raspberry Pi microcontroller boards
Topic: Wireless Pico Micropython REPL
Replies: 1
Views: 1309

Re: Wireless Pico Micropython REPL

There was a problem with the solution, at the time I posted the up/down keys for accessing MicroPython history did not seem to work. I have Pi4B and Pico here in hospital, but no ESP[01]. So I looked for another network to serial code that could be run on Pi4B for testing. I did find that code (to b...
by HermannSW
Sun May 02, 2021 7:47 pm
Forum: Programs, Libraries and Tools
Topic: Is there a working FSM library for micropython
Replies: 3
Views: 1737

Re: Is there a working FSM library for micropython

Raspberry Pico microcontroller micropython supports (8) hardware state machines.
by HermannSW
Fri Apr 30, 2021 1:41 pm
Forum: Programs, Libraries and Tools
Topic: lambda, apply, arbitrary precision
Replies: 2
Views: 955

Re: lambda, apply, arbitrary precision

This is more clean: def siglam(p,q): return (apply(range(p), lambda i: (apply(range(q), lambda j: C(i)*C(j)*C(p+q-i-j-1) )) )) Returns nested tuples >>> catalan.siglam2(3,2) ((14, 5), (5, 2), (4, 2)) >>> which "sum()" cannot handle -- but "sumit()" can: def sumit(t): return t if isinstance(t, (int,f...
by HermannSW
Thu Apr 29, 2021 4:38 pm
Forum: Programs, Libraries and Tools
Topic: lambda, apply, arbitrary precision
Replies: 2
Views: 955

Re: lambda, apply, arbitrary precision

Cosmetics, easier to read, does not use that much space horizontally, equivalent to previous code:

Code: Select all

def siglam(p,q):
    return sum(apply(range(p), lambda i:
               sum(apply(range(q), lambda j:
                   C(i)*C(j)*C(p+q-i-j-1)
               ))
           ))
        
by HermannSW
Tue Apr 27, 2021 4:08 pm
Forum: Programs, Libraries and Tools
Topic: lambda, apply, arbitrary precision
Replies: 2
Views: 955

lambda, apply, arbitrary precision

Today I stumbled over this identity for Catalan numbers: https://oeis.org/A000108 C(p+q)-C(p)*C(q) = Sum_{i=0..p-1, j=0..q-1} C(i)*C(j)*C(p+q-i-j-1). - Groux Roland, Nov 13 2009 Normally I use "bc" tool for arbitrary precision calculations, but realized that MicroPython allows for that as well. And ...
by HermannSW
Sat Apr 24, 2021 2:42 pm
Forum: Raspberry Pi microcontroller boards
Topic: Native machine code in Pico .mpy files
Replies: 0
Views: 1233

Native machine code in Pico .mpy files

"micropython/py/dynruntime.mk" does not know about "Pico" (cortex-m0plus) archtecture. I did hijack "armv7m" for the Pico and added support for Pico with 1line change commit on my micropython fork, that provides "string" example module with multiple member functions and multiple (int+str) arguments,...
by HermannSW
Thu Apr 22, 2021 11:28 am
Forum: Raspberry Pi microcontroller boards
Topic: Pico MicroPython with networking over USB
Replies: 10
Views: 2204

Re: Pico MicroPython with networking over USB

Can you help on MicroPython networking client examples (with and without ssl) only working with google. com? https://forum.micropython.org/viewtopic.php?f=15&t=10318 I identified root cause -- Micropython network http[s] examples are too sloppy, most webservers need "Host" header presented. I commi...
by HermannSW
Thu Apr 22, 2021 8:53 am
Forum: Programs, Libraries and Tools
Topic: [SOLVED] [Unix port] examples/network/http_client_ssl.py only works for google.com?
Replies: 3
Views: 832

[SOLVED] Re: [Unix port] examples/network/http_client_ssl.py only works for google.com?

I identified root cause: google.com is a bit sloppy, other http[s] servers need at least "Host" header presented! I fixed both network http[s] client examples, see this commit on my micropython fork for details: https://github.com/Hermann-SW/micropython/commit/bd5dfd1546ee091c30cf7dd7be293acf85fbb86...