[PA-01] Install Python

Foreword


This serie tutorial will show you how to communicate between Arduino and Python via serial port. Why Arduino? Because Arduino is the most popular till now. Why Python? Python is lightweight and I want to use Python with Raspberry Pi so this is how I met Python.

This serie is based on the work of Mr.Paul McWhorter with my modification. I honor his name because he makes it clear and effective for the newbies. You can visit these URL for reference:

Youtube: https://www.youtube.com/watch?v=95w4sx_zoB8&list=PLGs0VKk2DiYylFUUMMv9WiL3x3tpscDUQ

Website: http://www.toptechboy.com/using-python-with-arduino-lessons/ 


The serie Using Python with Arduino will be numbered with the syntax [PA] hyphen [2 digits of tutorial’s order]. This is [PA-01] tutorial and I will show you how to install Python on Window 10 64-bit

Step 1: go to http://vpython.org/contents/download_windows.html and follow 2 steps

PA01_install_python

Step 2: setup Environment Variables

Control Panel\System and Security\System –> Advanced system settings –> Environment Variables –> (below) System Variables –> Path –> (button) Edit –> New (add 2 directory C:\Python27 and C:\Python27\Scripts –> OK –> OK –> OK

PA01_install_setup_env var

Step 3: create folder python_code in Documents, this will save the code. Open VIDLE for VPython and type this code:

[Code]


print "Hail Hydra"

Then save it in the folder python_code with the name hello_world.py (remember the format .py). Run –> Run Module (or press F5) to execute the code in Python Shell and it will print out the phrase. To terminal the code excution press Ctrl+C (corrupt) the code (you do not need to press Ctrl+C right now, it is one step ahead)

 

Now it is finished. Next tutorial will show you how to install serial library on python with pyserial and how to use it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s