I had some problems getting it all to work and finding a basic tutorial online proved very difficult. So hopefully this guide will explain the basics to anyone that is looking to start using the serial functions that the arduino provides.
I'm going to assume that if you're reading this you have some knowledge of how an arduino works and how to upload sketches and what not, however I will explain the arduino code when we get there. The python code is very basic but I will do my best to explain it as well.
The code is not that hard to understand, the hard part is understanding how the serial communication works.
So, I'm going to show you how to tell your arduino to blink using your computer. Once you understand this you should be able to expand both the python code and the arduino code to fit your own projects.
Step 1: Sorting out Python
Once we have python installed were going to need a new library called PySerial. This is going to provide all the functions and methods we will need to talk to our arduino!
If you're using a windows machince check out their source forge page for the windows installer.
If you're using MacOS/linux your going to have to look around the PySerial website.
Also, if you're familiar with using Eclipse you might be intersted in the Python add-on for eclipse. Check it out if you would like to program in the eclipse environment.
Now if everything is installed we can actually start writing our Python program!