Search found 905 matches

by Roberthh
Thu May 03, 2018 5:36 am
Forum: General Discussion and Questions
Topic: Differences between urandom-module, uos.urandom and os.urandom?
Replies: 2
Views: 114

Re: Differences between urandom-module, uos.urandom and os.urandom?

On the ESP8266, os is just an alias for uos (see https://github.com/micropython/micropython/blob/master/ports/esp8266/mpconfigport.h#L175). So os.urandom() and uos.urandom() point to the same underlying function (starting here: https://github.com/micropython/micropython/blob/master/ports/esp8266/mod...
by Roberthh
Wed May 02, 2018 12:18 pm
Forum: General Discussion and Questions
Topic: Booting from SD card
Replies: 11
Views: 334

Re: Booting from SD card

At least you can have main.py on the SD card, if you mount th sd card in your flash based boot.py and tell MP via pyb.main() to use main.py or any other script instead from the SD card.
by Roberthh
Wed May 02, 2018 7:58 am
Forum: General Discussion and Questions
Topic: Booting from SD card
Replies: 11
Views: 334

Re: Booting from SD card

Take care that the SD card has only one (1) partition with a FAT file system. Some OSes add hidden partitions, which I found to confuse the PyBoard.
by Roberthh
Mon Apr 30, 2018 3:26 pm
Forum: Development of MicroPython
Topic: [SOLVED]native emitter - why not always enable?
Replies: 7
Views: 231

Re: native emitter - why not always enable?

If you have a .py and mark some, not all, functions as @micropython.native, is the entire file ineligible to be frozen?
Yes, as far as I can tell. You have split it into two files and import the native section.
by Roberthh
Mon Apr 30, 2018 9:16 am
Forum: Development of MicroPython
Topic: [SOLVED]native emitter - why not always enable?
Replies: 7
Views: 231

Re: native emitter - why not always enable?

There was a thread about being able to freeze both native code & viper code. It seemed not too difficult, but seemd not to be on the top priority list and has not been further discussed.
by Roberthh
Mon Apr 30, 2018 6:48 am
Forum: General Discussion and Questions
Topic: Help uart.read() with \r\n
Replies: 6
Views: 182

Re: Help uart.read() with \r\n

If you get single lines with just '\r' in them, you might simply skip these. If the '\r' is appended to a line, you can strip that from the incoming line.
by Roberthh
Mon Apr 30, 2018 5:59 am
Forum: Programs, Libraries and Tools
Topic: isue when using new FTPlib module
Replies: 4
Views: 175

Re: isue when using new FTPlib module

What I see is an ordinary ESP8266 with AT firmware connected to a serial port of the PyBoard. What I do not see is any link into the Network stack of Micropython. Unless that is given, you cannot use the standard socket interface.
by Roberthh
Thu Apr 26, 2018 12:09 pm
Forum: Programs, Libraries and Tools
Topic: TypeError: can't convert bytearray to int
Replies: 2
Views: 100

Re: TypeError: can't convert bytearray to int

The second argument of i2c.readfrom_mem_into is expected to be an int, not an array. So no need to copy the address into a bytearry first.
by Roberthh
Thu Apr 19, 2018 3:27 pm
Forum: General Discussion and Questions
Topic: Help writing and reading files
Replies: 10
Views: 258

Re: Help writing and reading files

With you approach, the hint of @OutoftheBOTS_ seems more appropriate, to use plain text files. You can write you float to the file with f.write("%f\n" & float_number), and read that back with s = f.readline(), converting that back to float with float(s).
by Roberthh
Thu Apr 19, 2018 5:39 am
Forum: General Discussion and Questions
Topic: Help writing and reading files
Replies: 10
Views: 258

Re: Help writing and reading files

Could it be that you reached the end of the file, in which case readline() returns an empty string? Since unpack of "f" requires 4 bytes, the buffer, having a length of 0, is too small.