Adding another .py files

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
ZeusLaser
Posts: 1
Joined: Mon Mar 02, 2015 8:15 pm

Adding another .py files

Post by ZeusLaser » Mon Mar 02, 2015 8:18 pm

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.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Adding another .py files

Post by dhylands » Tue Mar 03, 2015 3:30 am

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.

Post Reply