Search found 3174 matches

by dhylands
Sat Jun 15, 2019 4:07 pm
Forum: ESP8266 boards
Topic: LCD 1602 - Library
Replies: 42
Views: 17840

Re: LCD 1602 - Library

In particular, this code: msg = 'This is a scrolling test. ' if (len(msg) < lcd.num_columns): msg += ' ' * (lcd.num_columns - len(msg)) for i in range(len(msg)): len2 = min(lcd.num_columns, len(msg) - i) len1 = lcd.num_columns - len2 msg2 = '' if len2 > 0: msg2 += msg[i:i+len2] if len1 > 0: msg2 += ...
by dhylands
Sat Jun 15, 2019 4:04 pm
Forum: ESP8266 boards
Topic: LCD 1602 - Library
Replies: 42
Views: 17840

Re: LCD 1602 - Library

You need to use the i2c version and just extract the code that does the scrolling. The GPIO version doesn't work with LCDs that have i2c backpacks.
by dhylands
Fri Jun 14, 2019 4:50 pm
Forum: Other Boards
Topic: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote
Replies: 1
Views: 33

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

I ran into this on the F401 as well (when transferring over UART), and I haven't spent the time to figure out what the underlying problem is. I suspect that characters are being dropped on the UART connection. I'll see if I can look into this next week. This used to work, but it might have something...
by dhylands
Tue Jun 11, 2019 5:31 pm
Forum: General Discussion and Questions
Topic: Need help freeing memory from unused modules
Replies: 9
Views: 182

Re: Need help freeing memory from unused modules

By setting up your sys.path appropriately you can freeze everything and override just the portions that need to be overridden. sys.path contains a list of places to look for a module. The empty string is the place that it will look for frozen modules. So you can put a directory containing your overr...
by dhylands
Tue Jun 11, 2019 5:23 pm
Forum: ESP8266 boards
Topic: LCD 1602 - Library
Replies: 42
Views: 17840

Re: LCD 1602 - Library

Here's an example which scrolls text (using the GPIO version). def test_main(): """Test function for verifying basic functionality.""" print("Running test_main") lcd = GpioLcd(rs_pin=Pin.cpu.C6, enable_pin=Pin.cpu.C8, d4_pin=Pin.cpu.C2, d5_pin=Pin.cpu.C3, d6_pin=Pin.cpu.C4, d7_pin=Pin.cpu.C5, num_li...
by dhylands
Mon Jun 10, 2019 10:24 pm
Forum: MicroPython pyboard
Topic: How can I let my pyboard be registered as a USB Flash Drive while connecting through UART
Replies: 3
Views: 102

Re: How can I let my pyboard be registered as a USB Flash Drive while connecting through UART

Those tools won't let you transfer directly from one pybaord to another. I know with rshell that you can connect to 2 pyboards at the same time and use rshell to copy from pyboard to another. Both pyboards need to be connected to the same host computer. You could write your own code to transfer dire...
by dhylands
Mon Jun 10, 2019 10:23 pm
Forum: MicroPython pyboard
Topic: Import Pyserial Module
Replies: 10
Views: 226

Re: Import Pyserial Module

You need to instantiate an object. Your code should look like:

Code: Select all

usb = pyb.USB_VCP()
usb.write(b'helllo\r\n')
. Note that b'hello\r\n' 'hello\r\n'.encode() or ('hello\r\n').encode() all produce the same thing (namely b'hello\r\n')
by dhylands
Mon Jun 10, 2019 5:58 pm
Forum: ESP8266 boards
Topic: LCD 1602 - Library
Replies: 42
Views: 17840

Re: LCD 1602 - Library

The LCD displays are quite primitive. Here's a couple of references to the commands that can be sent to the LCD: http://web.alfredstate.edu/faculty/weimandn/index.html https://dawes.wordpress.com/2010/01/05/hd44780-instruction-set/ The typical way to achieve scrolling is to write new text which is s...
by dhylands
Thu Jun 06, 2019 8:30 pm
Forum: General Discussion and Questions
Topic: Need help freeing memory from unused modules
Replies: 9
Views: 182

Re: Need help freeing memory from unused modules

Be aware that when you're doing things from the REPL, the REPL keeps a bunch of history, including results from the previous command. These won't get gc'd until they get removed from history.
by dhylands
Thu Jun 06, 2019 7:33 pm
Forum: General Discussion and Questions
Topic: Need help freeing memory from unused modules
Replies: 9
Views: 182

Re: Need help freeing memory from unused modules

When you import a module, a reference to the module is stored in sys.modules. So you need to do something like: import sys del sys.modules['weather_station'] before doing the gc.collect I did the following: import gc import sys def do_beginning(): gc.collect() print('mem_free before =', gc.mem_free(...