Search found 10 matches

by efahl
Thu Oct 18, 2018 2:48 pm
Forum: General Discussion and Questions
Topic: re.sub regex won't match
Replies: 10
Views: 862

Re: re.sub regex won't match

Paul is saying that r'\n' and '\n' are completely different strings, which can be verified in any version of python.

r'\n' -> two-character string containing '\' and 'n'.
'\n' -> string containing a single newline character.

This is not a bug in r-strings, it is in fact the reason they exist.
by efahl
Wed Oct 03, 2018 2:46 pm
Forum: ESP8266 boards
Topic: os.listdir() garbage values.
Replies: 4
Views: 1226

Re: os.listdir() garbage values.

Corrupt file system?

Try:

Code: Select all

import uos
import flashbdev
uos.VfsFat.mkfs(flashbdev.bdev)
by efahl
Wed Aug 29, 2018 2:27 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 3577

Re: Matrix library for MicroPython

Are you talking about 4x4 quaternion matrices? I found quaternions and 3D rotations to be fascinating but difficult so I haven't grasped all their aspects: pardon me if the previous question is ignorant. Either way this is very cool and neat to know, thanks for sharing :) No, 3x3 direction cosine m...
by efahl
Fri Aug 24, 2018 7:57 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 3577

Re: Matrix library for MicroPython

Just an aside, what are you using these 3x3 matrices for? If they are 3D spatial transformations, then the matrix is orthonormal and its inverse is also its transpose. Our multibody dynamics code uses this to good advantage, and we have also added multiply_inverse and divide_inverse methods on the m...
by efahl
Sun Aug 12, 2018 3:17 pm
Forum: General Discussion and Questions
Topic: Are comments stripped out of code?
Replies: 4
Views: 696

Re: Are comments stripped out of code?

What about docstrings? I'm too lazy to look at the microPython docs, but I know that with cPython the -OO command line option strips out docstrings, which otherwise eat up space in the bytecode, just wondering of uPy has similar options.
by efahl
Thu May 10, 2018 2:03 pm
Forum: General Discussion and Questions
Topic: MicroPython compatibility with Python v3
Replies: 3
Views: 644

Re: MicroPython compatibility with Python v3

As bitninja indicates, Py 3 is fine. I use ampy and esptool with CPython 3.6.5 without issues.
by efahl
Sat Mar 31, 2018 4:14 pm
Forum: Other Boards
Topic: [STM32F401CE] debugging a new board definition [solved]
Replies: 49
Views: 5030

Re: [STM32F401CE] debugging a new board definition

You can't use a '-' in the macro name, it's a C operator. Changing them to underscore should work.
by efahl
Wed Jan 31, 2018 4:23 pm
Forum: Hardware Projects
Topic: Interactive MP3 Donations Box
Replies: 1
Views: 798

Re: Interactive MP3 Donations Box

You definitely do the coolest projects!
by efahl
Thu Jan 25, 2018 7:37 pm
Forum: ESP8266 boards
Topic: class DimLed ?
Replies: 7
Views: 2938

Re: class DimLed ?

You're doing inheritance a bit wrong, should look like this completely untested code: class DimLed(PWM): def __init__(self, pin): super().__init__(Pin(pin)) self.freq(1000) # Or whatever. def dim(self, factor): self.duty(some_function_of(factor)) (BBCode is enabled for you when you get sufficient po...
by efahl
Thu Jan 11, 2018 4:25 pm
Forum: MicroPython pyboard
Topic: Exception handling with files
Replies: 8
Views: 1914

Re: Exception handling with files

Looking at your code, it appears you simply want to append a timestamp to it? If that's the case, then there's no need to read the current contents, simply open it in append mode as Robert alludes. This probably won't help with the corruption issue, don't know what's going on there... [code]import t...