Search found 408 matches

by jimmo
Wed May 22, 2019 4:37 pm
Forum: ESP32 boards
Topic: Hardware SPI not working
Replies: 10
Views: 384

Re: Hardware SPI not working

Some ideas: - check that you have the right phase/polarity etc (does the logic analyser waveforms look like the datasheet) - confirm that what you see in the logic analyser decode mode (hopefully it has that for SPI) matches what you're sending and receiving in Python - are all responses incorrect o...
by jimmo
Wed May 22, 2019 4:32 pm
Forum: Development of MicroPython
Topic: filesystem access from c module
Replies: 5
Views: 287

Re: filesystem access from c module

If you include "py/builtin.h" you can use mp_builtin_open_obj directly to get the open function.

But you'll need to use mp_load_attr to get the file methods like read/write.

What goes wrong when you try to write to it? Compile or runtime error?
by jimmo
Wed May 22, 2019 9:23 am
Forum: ESP32 boards
Topic: [SOLVED] imports issue
Replies: 5
Views: 204

Re: imports issue

As far as imports go, there's no distinction between classes, functions or just plain old variables. It just so happens that in the "import foo" case, the "foo" you get looks a bit like a class because you use the "." notation to access its contents. i e. if this was foo.py def bar(): print('bar') c...
by jimmo
Wed May 22, 2019 9:06 am
Forum: ESP32 boards
Topic: [SOLVED] imports issue
Replies: 5
Views: 204

Re: imports issue

You should be able to do exactly what you did in the REPL from main.py

It's just like regular Python. If you have foo.py containing "def bar".

Code: Select all

import foo
foo.bar()
or

Code: Select all

from foo import bar
bar()
by jimmo
Wed May 22, 2019 2:58 am
Forum: General Discussion and Questions
Topic: Cannot overload float()
Replies: 2
Views: 151

Re: Cannot overload float()

Unfortunately__float__ is not implemented in MicroPython. If you're interested in the implementation of __int__ search for MP_UNARY_OP_INT in the repo.
by jimmo
Wed May 22, 2019 1:27 am
Forum: ESP32 boards
Topic: URL string
Replies: 1
Views: 122

Re: URL string

Looks like you're talking about URL escaping (or encoding). Maybe take a look at using https://github.com/micropython/micropython-lib/blob/master/urllib.parse/urllib/parse.py It's relatively straightforward to do the transformation yourself %xx --> int(xx, 16). But fom your example I can't tell if y...
by jimmo
Tue May 21, 2019 3:37 pm
Forum: General Discussion and Questions
Topic: double precision float on ESP8266
Replies: 29
Views: 1012

Re: double precision float on ESP8266

Hardware floating point only means "floating point in hardware". Micropython can do any floating point in software. This will be considerably slower for a CPU, but as a human you won't notice any difference in speed. It's true that if you use "double" in C even without hardware support for double p...
by jimmo
Tue May 21, 2019 3:18 pm
Forum: ESP32 boards
Topic: [SOLVED] external interrupts spam
Replies: 4
Views: 203

Re: external interrupts spam

Sounds like classic switch debouncing? In addition to the software approaches dhylands mentions, have you tried adding some capacitance to the switch?

e.g. this first google result seems pretty good https://hackaday.com/2015/12/09/embed-w ... ns-part-i/
by jimmo
Mon May 20, 2019 9:27 pm
Forum: ESP32 boards
Topic: Hardware SPI not working
Replies: 10
Views: 384

Re: Hardware SPI not working

Out of curiosity does it work if you use software SPI instead? (i.e. just remove the `2` from the SPI constructor).
by jimmo
Mon May 20, 2019 1:06 pm
Forum: Programs, Libraries and Tools
Topic: MemoryError on importing large files
Replies: 4
Views: 193

Re: MemoryError on importing large files

And if it's an option for you, try freezing the rarely-changing modules into a firmware build. (By putting the code in boards/<BOARD>/modules). This means that they'll execute from ROM, saving even more RAM for your main program.