Search found 147 matches

by liudr
Thu Aug 16, 2018 3:53 pm
Forum: General Discussion and Questions
Topic: [SOLVED] UART.readline() not using timeout
Replies: 8
Views: 1418

Re: UART.readline() not using timeout

pythoncoder wrote:
Thu Aug 16, 2018 8:26 am
If you spot an error in the documentation why not submit a GitHub pull request to fix it?
Peter,

Thanks for the suggestion. I opened an issue on github. Another potential place to improve is to define some alias for time.sleep() as time.sleep_s() since there are already _ms and _us counterparts.
by liudr
Wed Aug 15, 2018 11:14 am
Forum: General Discussion and Questions
Topic: [SOLVED] UART.readline() not using timeout
Replies: 8
Views: 1418

Re: UART.readline() not using timeout

As he's using loboris port, I'm not sure the official docs apply to this. There is only esp8266 official doc: http://docs.micropython.org/en/latest/esp8266/library/machine.UART.html Units are not mentioned. Here is wipy port doc. Same thing: http://docs.micropython.org/en/latest/wipy/library/machin...
by liudr
Tue Aug 14, 2018 7:45 pm
Forum: General Discussion and Questions
Topic: [SOLVED] UART.readline() not using timeout
Replies: 8
Views: 1418

Re: UART.readline() not using timeout

Loboris, Thanks for your quick response! The wiki indicates that the function will wait until timeout but my experience has been "it doesn't". The real reason was that timeout was in milliseconds in MicroPython but in seconds in PC pyserial. Neither explicitly mentions on the constructor what time u...
by liudr
Tue Aug 14, 2018 5:59 pm
Forum: General Discussion and Questions
Topic: [SOLVED] UART.readline() not using timeout
Replies: 8
Views: 1418

[SOLVED] UART.readline() not using timeout

[EDIT] timeout in MicroPython machine.UART is in milliseconds instead of seconds in PC Python pyserial module. I did some tests and realized that UART.readline() doesn't timeout. Instead, it immediately returns an empty byte string. I am puzzled at why we can specify timeout if this call doesn't uti...
by liudr
Tue Aug 14, 2018 5:29 pm
Forum: General Discussion and Questions
Topic: RPi and micropython
Replies: 6
Views: 1030

Re: RPi and micropython

Post links to those resources you're using. That might help those that want to help you to get started.
by liudr
Tue Aug 14, 2018 1:03 am
Forum: General Discussion and Questions
Topic: Exception FileNotFoundError is not defined
Replies: 2
Views: 870

Re: Exception FileNotFoundError is not defined

Thanks. It works on both MicroPython and PC Python.
by liudr
Thu Aug 09, 2018 8:54 pm
Forum: General Discussion and Questions
Topic: Exception FileNotFoundError is not defined
Replies: 2
Views: 870

Exception FileNotFoundError is not defined

Here is my script's snippet: def load_paras(): # Load operating parameters from default dictionary. # The function returns a dictionary, which has keys for all parameters needed in the program. # Any err loading parameters will result in default parameters and False. try: f = open(config_file_name, ...
by liudr
Thu Aug 09, 2018 7:35 pm
Forum: General Discussion and Questions
Topic: uos vs os
Replies: 2
Views: 657

uos vs os

I am still uncertain after reading official doc on the uos vs os (or u-anything vs anything). Can someone give me a quick explanation? http://docs.micropython.org/en/latest/esp8266/library/index.html Anyway, trying to use uos instead of os in my MicroPython code but I still want to share as much cod...
by liudr
Thu Aug 09, 2018 4:25 am
Forum: General Discussion and Questions
Topic: How exactly does import work (like #include??)
Replies: 2
Views: 593

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

I'm learning Python myself, with a C background. I would recommend you to do a skeletal module and main.py to investigate and learn. From what I read on a python book, import executes all code in the imported library and adds the imported code's name space to the current name space. Say you: import ...
by liudr
Mon Aug 06, 2018 8:27 pm
Forum: General Discussion and Questions
Topic: Can main.py and REPL share any variables?
Replies: 1
Views: 400

Re: Can main.py and REPL share any variables?

It's odd. I wasn't able to access variables I defined in main.py in REPL before but now I can. Maybe it's because I ran into some syntax errors in main.py

Hope that was the reason.