Tpyboard getting Micropython Tips

Source: Internet
Author: User

REPL (interactive interpreter?) The full name is the Read Evaluate Print Loop, Tpyboard allows the user and Micorpython to connect interactively. Using REPL is the easiest way to test your code and run instructions. With REPL you can go to

Add script content to the main.py.

Using REPL requires a USB serial port to connect the Tpyboard. How this is done depends on the development environment.

1.Windows

Using a USB serial drive requires the installation of the Tpyboard driver, which is called Pybcdc.inf in the Tpyboard USB flash drive. To install the driver, you need to find the Tpyboard device in the Device Manager list in your computer (there should be a yellow warning icon next to the device that is not working), right-click on the device, select the tool (properties), and then install the driver. The user needs to manually select the option to find the driver (not via Windows Auto-upgrade) and install it. After installation, go back to Device Manager to find the installed Tpyboard and see if it uses that port (for example, COM4). More information can be found on the guide's Tpyboard on Windows (PDF) document. If you have any problems with the driver installation, please check it in time.

You need to run the terminal program at this point. Users can use Hyper Terminal this tool, or download the free program PuTTY:putty.exe. The serial program runs through the COM port found in the previous step. For Putty, click on the "Session" on the left side of the screen, click on the "Serial" button on the right, then select the COM port (e.g. COM4) in the serial line, and then click the "Open" button.

2. Mac OSX

Open the terminal and run:

screen/dev/tty.usbmodem*

When you want to terminate the exit interface, use the shortcut key ctpl-a ctrl-\

3.Linux

Open the terminal and run:

Screen/dev/ttyacm0

You can also try piocom or minicom connection rather than the terminal interface. Users need to use/DEV/TTYACM1 or higher TTYACM numbers. Also, users need to give themselves the right permissions to connect to the device (for example, group UUCP or dialout, or permissions sudo).

4. using the interactive selector

You can now run the Micropython code directly on the Tpyboard.

Open the serial port program (for example, Putty, terminal interface, piocom, etc.) to see an empty screen with a blinking cursor. Press any key to enter the Micropython interpreter, which is displayed as >>>. The following procedures can be used to confirm whether to enter:

>>> print ("Hello tpyboard!")

Hello tpyboard!

Instead of typing >>> characters in the above routines, the user should write to the interpreter. At the end, once you enter print ("Hello world!") Text and press ENTER, the output will appear on the screen as above.

Familiarity with the Python language allows you to try writing different instructions. If the print is unsuccessful, try the hardware reset below or the software reset method. You can continue to enter other directives such as:

>>> Pyb. LED (1). On ()

>>> Pyb. LED (2). On ()

>>> 1 + 2

3

>>> 1/2

0.5

>>> * ' py '

' Pypypypypypypypypypypypypypypypypypypypy '

5 , Reset

In case of an error, the board can be reset in two ways. One is to enter ctrl-d in the Micropython interpreter for software reset. The message that appears is as follows:

>>>

Pyb:sync filesystems

Pyb:soft reboot

Micro Python v1.0 on 2014-05-03; PYBv1.0 with STM32F405RG

Type ' Help () ' For more information.

>>>

If this does not work, you can reset the hardware by pressing the RTS key (the black button on the USB cable in the Development Board). This will disconnect any port connected to the Tpyboard

If you are ready to perform a hardware reset, it is strongly recommended to turn off the serial program and with the exit/unload Tpyboard device.

Tpyboard getting Micropython Tips

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.