Pyboard.py

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
tcnaks5
Posts: 6
Joined: Tue Aug 18, 2020 2:18 pm

Pyboard.py

Post by tcnaks5 » Tue Aug 18, 2020 2:30 pm

Hello, Newbie here.

I am an experienced software developer, but my experience has mainly been limited to web development so I have not dealt with python ever (the experience was internships and other side jobs while in college).

I recently started a project trying to develop an application for the pyboard and I am stuck in the very beginning. I have been looking all over the internet and this form to find a guide to using Pyboard.py. As I understand it I can use it to run a script on the board without having to flash it to the board? with that I have been able to successfully open putty and run commands on the board but not a whole script with using the reset button and restarting the board. Any help on a step by step for using Pyboard.py would be fantastic.

Second question: When I run a script on my pyboard, where does the print statement go? how can I view what is printed?

thanks for the help!

Stevo52
Posts: 38
Joined: Sun Feb 03, 2019 10:28 pm

Re: Pyboard.py

Post by Stevo52 » Wed Aug 19, 2020 3:21 am

Welcome to the pyboard and Micropython world... and this forum..

The first steps you take can be quite daunting but it won't take you long to get the hang of it all.

Firstly - which pyboard model do you have? There are a few different ones... :-)

Start here maybe: https://store.micropython.org/ to see which model

And then here: http://docs.micropython.org/en/latest/

For more info on pyboard.py start here: http://docs.micropython.org/en/latest/r ... board%20py

Basically you will need to connect to the board first and start a REPL (read–eval–print loop).. what apps/services you need depends very much on what device you use to connect to the pyboard. But something as simple as PuTTY works, although other serial consoles work too. It depends very much on the 'environment' you are comfortable with. If you are using PuTTY for commands, then print results should come back to there.

Don't be afraid to ask questions.. lots of helpful people here :-)

tcnaks5
Posts: 6
Joined: Tue Aug 18, 2020 2:18 pm

Re: Pyboard.py

Post by tcnaks5 » Wed Aug 19, 2020 2:33 pm

Thanks for the help!

I have this board:
MicroPython pyboard v1.1 with headers
PYBv1.1H

I am struggling from the start, accessing the pyboard.py tool doesn't seem to be working. I didn't see anywhere on the docs how to import the pyboard.py tool. Everything I found says to just start executing commands using `pyboard.py`so from the start I can't connect to the tool. Should I be trying to use the pyboard.py tool in command line or in PuTTY? I just want to be able to run a script without having to flash the board and then I also want to see any output print statements from the script I write.

Hope that clarifies my needs, thanks!

tcnaks5
Posts: 6
Joined: Tue Aug 18, 2020 2:18 pm

Re: Pyboard.py

Post by tcnaks5 » Wed Aug 19, 2020 3:13 pm

update:

I got pyboard.py work running but it won't connect to my device saying it failed to access /dev/ttyACM0

I downloaded micropython and don't have it in the same directory as the regular python, but I moved the pyboard.py file into the directory of the script I was running and it finally recognized it. How should I set up my file system to use both python and micropython? and use the pyboard.py tool without having to fanagle it haha

thanks

Stevo52
Posts: 38
Joined: Sun Feb 03, 2019 10:28 pm

Re: Pyboard.py

Post by Stevo52 » Thu Aug 20, 2020 12:38 am

OK.. what device are you using to connect to the pyboard? Windows?

I am not sure how you have determined that the pyboard and pyboard.py is running.. your comment indicates that it isn't?

When you connect the pyboard, do you see the device on the PC? like in Device Manager or Windows Explorer.

I don't have a pyboard v1.1 here to try (I use the Pyboard D devices that expose the flash drive of the board when connected).

But from https://store.micropython.org/product/PYBv1.1H your device should basically work the same way..

The tutorial might help.. start slow and follow all the instructions to get a feel for how it works.. https://docs.micropython.org/en/latest/ ... index.html

Once the pyboard and PC are connected you should be able to connect with PuTTY (using the com port you can see in Device Manager) as a REPL to communicate with the pyboard and get responses, and something as basic as Notepad (Notepad++ is better) will allow you to open boot.py and main.py to view and edit, plus create more scripts (you will always need a boot.py file for the board to start from and main.py runs after boot.py). Other code can be in seperate module files but initially you can either write some test code directly on the REPL or in main.py. If you use a seperate module file (with .py extension) for your own code experiments, then you can call code in that file from main.py. You will need to understand the basics of the Micropython language as you go..

Sounds a bit complicated but it isn't really and the tutorial will help you.. there is a lot of information on the Micropython site but you do have to dig around for some of it, which is all part of the fun when you are just stating out - but it gets easier with time.. :-)

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

Re: Pyboard.py

Post by dhylands » Thu Aug 20, 2020 1:54 am

Also note that using pyboard.py requires that you disconnect putty from your board while using pyboard.py

tcnaks5
Posts: 6
Joined: Tue Aug 18, 2020 2:18 pm

Re: Pyboard.py

Post by tcnaks5 » Thu Aug 20, 2020 2:01 pm

Sorry I am running on Windows 10 Enterprise

I figured that I had pyboard working because I was about to run commands through it (the help function was the only one that did anything). All the other commands I tried failed because it failed to access /dev/ttyACM0. I figured that that was probably because my driver was not properly installer and so I double checked and found that it had not installed the pyboard serial driver but instead some other basic windows driver. However I cannot install the driver because it is unsigned, and this is a work computer, so I will have to wait for permissions to do that.

my goal is to be able to create a script test.py and then be able to run the command `python pyboard.py test.py` and have it execute my script on the board and print all the outputs in the command line.

If my assumption is wrong about the driver feel free to let me know, thanks for all the help

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

Re: Pyboard.py

Post by dhylands » Thu Aug 20, 2020 3:11 pm

On Windows you need to tell it the com port using the -device parameter (I.e. something like

Code: Select all

pyboard.py -device COM7 foo.py
replace COM7 with the correct com port for your setup. /dev/ttyAMA0 only works under Linux.

tcnaks5
Posts: 6
Joined: Tue Aug 18, 2020 2:18 pm

Re: Pyboard.py

Post by tcnaks5 » Thu Aug 20, 2020 3:38 pm

Thanks you so much! it worked, that's all I needed!

vikascht
Posts: 5
Joined: Fri Feb 12, 2021 4:47 pm

Re: Pyboard.py

Post by vikascht » Fri Feb 12, 2021 5:30 pm

I am connected to my laptop. In the device manager I can see as COM5.
I opened a putty application and I have done serial communication. It was working for 10-20 times and i have executed some of the basic codes. I was happy that i am into micropython but after some time i am unable to open serial port using Putty application.
After multiple times hardware as well as SW reset also i am not able to open serial communication. Now i am unable to see >>> symbol on putty screen.
Hardware reset also not giving me solution.
Any solution??

Post Reply