Search found 38 matches

by Christian Walther
Mon Nov 19, 2018 6:45 pm
Forum: ESP8266 boards
Topic: Trouble flashing the image
Replies: 8
Views: 409

Re: Trouble flashing the image

Is "esptool" a way to get the Firmware from my PC to the ESP8266? Or is it something i need to do after I allready flashed the firmware. esptool runs on your PC, not on the MicroPython board, and yes, it is a tool to flash the firmware onto the board. After connecting with putty however i just saw ...
by Christian Walther
Sun Oct 28, 2018 10:41 am
Forum: General Discussion and Questions
Topic: what "type" is an SHA-256 result, and how do I most easily convert it into a string?
Replies: 3
Views: 303

Re: what "type" is an SHA-256 result, and how do I most easily convert it into a string?

It’s actually a bytes , not a bytearray (former is immutable, latter is mutable). Try type(myHash) and read https://docs.python.org/3/library/stdtypes.html to learn about Python’s built-in types. You didn’t specify what your resulting string should be, but one way of converting your hexHash (a bytes...
by Christian Walther
Sat Oct 27, 2018 9:14 am
Forum: ESP8266 boards
Topic: Pin.IN value always 1
Replies: 2
Views: 270

Re: Pin.IN value always 1

The state of an input pin is undefined when there is nothing connected to it. Have you tried connecting it to GND or 3.3V? (This applies to all digital circuits, not just the ESP8266.)
by Christian Walther
Sat Aug 18, 2018 9:05 pm
Forum: General Discussion and Questions
Topic: Need some help how to distribute features between main.py and scripts on sd card
Replies: 13
Views: 1158

Re: Need some help how to distribute features between main.py and scripts on sd card

I think what’s confusing you is that you think of your Python files as scripts . They are not (apart from boot.py and main.py ), they are modules . Defining functions in one module and calling them from another, as you propose, is the right way to go, and as pythoncoder shows, you can pass them anyt...
by Christian Walther
Thu Aug 09, 2018 7:41 am
Forum: General Discussion and Questions
Topic: How exactly does import work (like #include??)
Replies: 2
Views: 373

Re: How exactly does import work (like #include??)

I suspect the reason why you are not getting more help is that this is not MicroPython-specific, and is not a particularly appealing question to answer because it can easily be answered by reading documentation: Reference , Tutorial . Short answer: Yes, import does not work like #include . liudr’s r...
by Christian Walther
Wed Aug 08, 2018 4:39 pm
Forum: ESP8266 boards
Topic: [SOLVED] import module from filesystem
Replies: 2
Views: 485

Re: import module from filesystem

The import statement takes a name, not an expression. You want the __import__ function (ignore the reference to importlib , it doesn’t exist on MicroPython). See https://github.com/pewpew-game/pewpew/blob/master/games/menu.py for a working example of the exact thing you want to do. It’s in CircuitPy...
by Christian Walther
Mon Jul 30, 2018 8:01 pm
Forum: ESP8266 boards
Topic: timezone support in MicroPython ?
Replies: 10
Views: 3094

Re: timezone support in MicroPython ?

You don’t even need to write that program, it already exists: the zic time zone compiler that is part of the zoneinfo database. If you are on any kind of Unix-like OS, you likely have its output already in /usr/share/zoneinfo/ : binary files containing exactly such a list of transition times (among ...
by Christian Walther
Wed Jul 25, 2018 4:56 am
Forum: General Discussion and Questions
Topic: Are anonymous objects at risk of GC? SOLVED
Replies: 8
Views: 527

Re: Are anonymous objects at risk of GC?

Heh, my Python 2 background is showing through – I wasn’t aware of the nonlocal statement, thanks!
by Christian Walther
Tue Jul 24, 2018 6:36 pm
Forum: General Discussion and Questions
Topic: Are anonymous objects at risk of GC? SOLVED
Replies: 8
Views: 527

Re: Are anonymous objects at risk of GC?

The instances variable does not have global scope, it is a local variable of function singleton and is initialized to a new dict every time that function is called. Which means that when you apply your @singleton decorator to two classes, you will not get a dict with two entries, as I suspect you th...
by Christian Walther
Tue Oct 25, 2016 11:05 am
Forum: ESP8266 boards
Topic: Support for 512K modules reinstated
Replies: 2
Views: 1351

Re: Support for 512K modules reinstated

Yay! 8-) I was never quite sure whether supporting them was still an official goal, given that the documentation still states “The minimum requirement for flash size is 512k. A board with this amount of flash will not have room for a filesystem, but otherwise is fully functional.”, even though that ...