Page 1 of 1

Adding another .py files

Posted: Mon Mar 02, 2015 8:18 pm
by ZeusLaser
Hello everyone,

I am pretty new to programming with the micropython board and couldn't find any information on how to do this.

I'm currently working on interfacing with a 16x2 LCD screen and found some code I wanted to test at
https://github.com/wjdp/micropython-lcd
and I don't know how to add the lcd.py files to microcontroller.

I'm working on windows 8.1 and when I plug in the board, I insert the lcd.py file in the removable drive that pops up.
Is that the correct place to add the file? If it isn't where am I supposed to put the file, and how would I do that?

Thank you for taking the time to read this.

Re: Adding another .py files

Posted: Tue Mar 03, 2015 3:30 am
by dhylands
Any files that you place in the removable drive will appear to be at the root of the filesystem as far as the pyboard is concerned.

Under linux, I normally do the following procedure:

1 - Copy the file to the removable drive
2 - Wait about 5 seconds for the drive data to be flushed
3 - On the python REPL, I then do Control-D. Without this, the pyboard won't know about the new file.
4 - Then from the REPL, I can import my file.

Sometimes I don't wait long enough at step 2 and I get mangled files.

To be really sure, for step 2, you can do an eject of the removable drive. This will flush everything.