1 / 22

Lab 5 Environment setup

Lab 5 Environment setup. Beaglebone Library for Python Introduction to Python Programming exercise. Beaglebone Library for Python. Library for Beaglebone – PyBBIO Including bbio libraries and so on. Provides pin configuration and functions we need when programming.

marlis
Télécharger la présentation

Lab 5 Environment setup

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab 5 Environment setup • BeagleboneLibrary for Python • Introduction to Python • Programming exercise

  2. Beaglebone Library for Python • Library for Beaglebone– PyBBIO • Including bbio libraries and so on. • Provides pin configuration and functions we need when programming. • Download and update from internet.

  3. Beaglebone Library for Python • Step1Connect Beagleboneto PC through USB cable and to router(DHCP supporting) by Ethernet cable . • Step2 Log in to your Beaglebone with Terminal program. • Step3 Make sure your beaglebone getting on the Internet.Using ping instruction.Ex: ping google.comEnd it by using Ctrl+c

  4. Beaglebone Library for Python • Step4 Download BeagleBone Library for Pythonpython-distutils, python-mmap, python-pyserial and PyBBIO • Type in ↓opkg update && opkg install python-distutils python-mmap python-pyserial

  5. Beaglebone Library for Python • Type in↓cd ~/*Changes to root directory

  6. Beaglebone Library for Python • Type in ↓git clone git://github.com/alexanderhiam/PyBBIO.gitLoad(Clone) PyBBIO.git to your Beaglebone. • Check “root” directory by ls, make sure there is a folder “PyBBIO”

  7. Beaglebone Library for Python • Step5 Change directory to PyBBIO and see if there is a file setup.py

  8. Beaglebone Library for Python • Step 6 Install PyBBIO by ↓python setup.py install • All will get ready when installation has done.

  9. Introduction to Python • Python has been provided in our Beaglebone OS • Type in python –V for checking version.

  10. Introduction to Python • Type in python for getting into conversation mode

  11. Introduction to Python • Try to input >>> a=5>>> b=3>>> a+b>>> a-b>>> a*b>>> a/b>>>a%bafter ‘>>>’ • See what happened.

  12. Introduction to Python • Use quit() to leave conversation mode.

  13. Introduction to Python • Write a python source code file with .py . • Run Python source code bypython xxx.py

  14. Introduction to Python • Printprint xxxprint ‘xxx’ or print “xxx”print value • Print multiple objectprint ‘abc’, 10result = root@beaglebone:# abc 10 • raw_input()raw_input(“Index”)

  15. Introduction to Python • Flow control • If [condiction]: statement 1elif [condiction]: statement 2else: statement 3 • Distinguish statement by indent.

  16. Introduction to Python • while [condiction]: statement statement statement

  17. Introduction to Python • for [var] in range([init.], [term.], [step]):statementEx: for i in range (1, 16, 3 ) • for [var] in [array]:statementEx: for j in my_array

  18. Introduction to Python • Nest loop • for [var] in range(): for [var] in range(): statement2 statement1

  19. Programming exercise • 1. Write a program enable you to input your Student ID and nickname.Print out the information.

  20. Programming exercise • 2. Write the instructions we mentioned in example of conversation mode into a file and execute it.Print the results.

  21. Programming exercise • 3. Print out the 9*9 table. Using flow control statement.

  22. References • Victor 程式設計教學 • http://ez2learn.com/index.php/python-tutorials/python-basic-tutorials • Head First Python–O’Reilly • Google “Python”

More Related